Skip to content

Commit

Permalink
setConfig is deprecated, use setInfo or allocPixels instead
Browse files Browse the repository at this point in the history
kPMColor_SkColorType -> kN32_SkColorType

TBR=scherkus@chromium.org,benwells@chromium.org
BUG=skia:2706

Review URL: https://codereview.chromium.org/357213002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@280805 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
reed@google.com committed Jul 1, 2014
1 parent 73c5b69 commit b2f17e9
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 18 deletions.
5 changes: 1 addition & 4 deletions components/favicon_base/favicon_util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,7 @@ SkBitmap ResizeBitmapByDownsamplingIfPossible(
// Use nearest neighbour resampling if upsampling by an integer. This
// makes the result look similar to the result of SelectFaviconFrames().
SkBitmap bitmap;
bitmap.setConfig(SkBitmap::kARGB_8888_Config,
desired_size_in_pixel,
desired_size_in_pixel);
bitmap.allocPixels();
bitmap.allocN32Pixels(desired_size_in_pixel, desired_size_in_pixel);
if (!best_bitmap.isOpaque())
bitmap.eraseARGB(0, 0, 0, 0);

Expand Down
3 changes: 1 addition & 2 deletions components/favicon_base/select_favicon_frames.cc
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@ size_t BiggestCandidate(const std::vector<gfx::Size>& candidate_sizes) {

SkBitmap SampleNearestNeighbor(const SkBitmap& contents, int desired_size) {
SkBitmap bitmap;
bitmap.setConfig(SkBitmap::kARGB_8888_Config, desired_size, desired_size);
bitmap.allocPixels();
bitmap.allocN32Pixels(desired_size, desired_size);
if (!contents.isOpaque())
bitmap.eraseARGB(0, 0, 0, 0);

Expand Down
3 changes: 1 addition & 2 deletions extensions/renderer/set_icon_natives.cc
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,7 @@ bool SetIconNatives::ConvertImageDataToBitmapValue(
}

SkBitmap bitmap;
bitmap.setConfig(SkBitmap::kARGB_8888_Config, width, height);
if (!bitmap.allocPixels()) {
if (!bitmap.allocN32Pixels(width, height)) {
isolate->ThrowException(
v8::Exception::Error(v8::String::NewFromUtf8(isolate, kNoMemory)));
return false;
Expand Down
6 changes: 2 additions & 4 deletions media/filters/skcanvas_video_renderer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,8 @@ static void ConvertVideoFrameToBitmap(
if (bitmap->isNull() ||
bitmap->width() != video_frame->visible_rect().width() ||
bitmap->height() != video_frame->visible_rect().height()) {
bitmap->setConfig(SkBitmap::kARGB_8888_Config,
video_frame->visible_rect().width(),
video_frame->visible_rect().height());
bitmap->allocPixels();
bitmap->allocN32Pixels(video_frame->visible_rect().width(),
video_frame->visible_rect().height());
bitmap->setIsVolatile(true);
}

Expand Down
8 changes: 3 additions & 5 deletions media/video/capture/fake_video_capture_device.cc
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,10 @@ void FakeVideoCaptureDevice::OnCaptureTask() {
VideoFrame::AllocationSize(VideoFrame::I420, capture_format_.frame_size);
memset(fake_frame_.get(), 0, frame_size);

SkImageInfo info = SkImageInfo::MakeA8(capture_format_.frame_size.width(),
capture_format_.frame_size.height());
SkBitmap bitmap;
bitmap.setConfig(SkBitmap::kA8_Config,
capture_format_.frame_size.width(),
capture_format_.frame_size.height(),
capture_format_.frame_size.width()),
bitmap.setPixels(fake_frame_.get());
bitmap.installPixels(info, fake_frame_.get(), info.width());
SkCanvas canvas(bitmap);

// Draw a sweeping circle to show an animation.
Expand Down
2 changes: 1 addition & 1 deletion skia/ext/bitmap_platform_device_mac.cc
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ void BitmapPlatformDevice::DrawToNativeContext(CGContextRef context, int x,

SkBaseDevice* BitmapPlatformDevice::onCreateDevice(const SkImageInfo& info,
Usage /*usage*/) {
SkASSERT(info.colorType() == kPMColor_SkColorType);
SkASSERT(info.colorType() == kN32_SkColorType);
return BitmapPlatformDevice::CreateAndClear(info.width(), info.height(),
info.isOpaque());
}
Expand Down

0 comments on commit b2f17e9

Please sign in to comment.