diff options
author | reed <reed@google.com> | 2015-07-17 10:05:51 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-07-17 17:06:33 +0000 |
commit | 7d8235620cf6094b281029a519a76ce0cb41c466 (patch) | |
tree | cec8957bd8d09f6fae847027c6796d093d08d8d4 | |
parent | 264f8d41596d249c2472606ee6cc01664d235420 (diff) | |
download | chromium_src-7d8235620cf6094b281029a519a76ce0cb41c466.zip chromium_src-7d8235620cf6094b281029a519a76ce0cb41c466.tar.gz chromium_src-7d8235620cf6094b281029a519a76ce0cb41c466.tar.bz2 |
api refactor: switch to modern variants of drawBitmapRect
drawBItmapRect has a long history of tweaks to its api (intrect, floatrects, flags -> constraints, etc.). This CL brings these call-sites up2date, allowing Skia (later) to remove a swath of legacy compatibility methods/types.
https://codereview.chromium.org/1237233007/ has already landed in Blink.
BUG=
CQ_INCLUDE_TRYBOTS=tryserver.blink:linux_blink_rel
TBR=danakj@chromium.org
Review URL: https://codereview.chromium.org/1224263006
Cr-Commit-Position: refs/heads/master@{#339274}
-rw-r--r-- | cc/output/software_renderer.cc | 14 | ||||
-rw-r--r-- | chrome/browser/themes/browser_theme_pack.cc | 2 | ||||
-rw-r--r-- | components/favicon_base/favicon_util.cc | 3 | ||||
-rw-r--r-- | components/favicon_base/select_favicon_frames.cc | 3 | ||||
-rw-r--r-- | content/browser/devtools/protocol/color_picker.cc | 2 | ||||
-rw-r--r-- | content/renderer/media/android/webmediaplayer_android.cc | 2 | ||||
-rw-r--r-- | content/renderer/npapi/webplugin_delegate_proxy.cc | 2 | ||||
-rw-r--r-- | content/renderer/pepper/pepper_graphics_2d_host.cc | 4 | ||||
-rw-r--r-- | skia/config/SkUserConfig.h | 4 | ||||
-rw-r--r-- | ui/gfx/canvas.cc | 2 | ||||
-rw-r--r-- | ui/ozone/platform/drm/gpu/drm_window.cc | 2 |
11 files changed, 15 insertions, 25 deletions
diff --git a/cc/output/software_renderer.cc b/cc/output/software_renderer.cc index a8110ef..c34fb4d 100644 --- a/cc/output/software_renderer.cc +++ b/cc/output/software_renderer.cc @@ -472,10 +472,8 @@ void SoftwareRenderer::DrawTextureQuad(const DrawingFrame* frame, paint.setShader(shader.get()); current_canvas_->drawRect(quad_rect, paint); } else { - current_canvas_->drawBitmapRectToRect(*bitmap, - &sk_uv_rect, - quad_rect, - ¤t_paint_); + current_canvas_->drawBitmapRect(*bitmap, &sk_uv_rect, quad_rect, + ¤t_paint_); } if (needs_layer) @@ -503,11 +501,9 @@ void SoftwareRenderer::DrawTileQuad(const DrawingFrame* frame, SkRect uv_rect = gfx::RectFToSkRect(visible_tex_coord_rect); current_paint_.setFilterQuality( quad->nearest_neighbor ? kNone_SkFilterQuality : kLow_SkFilterQuality); - current_canvas_->drawBitmapRectToRect( - *lock.sk_bitmap(), - &uv_rect, - gfx::RectFToSkRect(visible_quad_vertex_rect), - ¤t_paint_); + current_canvas_->drawBitmapRect(*lock.sk_bitmap(), &uv_rect, + gfx::RectFToSkRect(visible_quad_vertex_rect), + ¤t_paint_); } void SoftwareRenderer::DrawRenderPassQuad(const DrawingFrame* frame, diff --git a/chrome/browser/themes/browser_theme_pack.cc b/chrome/browser/themes/browser_theme_pack.cc index 51512e6..4584d3c 100644 --- a/chrome/browser/themes/browser_theme_pack.cc +++ b/chrome/browser/themes/browser_theme_pack.cc @@ -488,7 +488,7 @@ SkBitmap CreateLowQualityResizedBitmap(const SkBitmap& source_bitmap, SkRect scaled_bounds = RectToSkRect(gfx::Rect(scaled_size)); // Note(oshima): The following scaling code doesn't work with // a mask image. - canvas.drawBitmapRect(source_bitmap, NULL, scaled_bounds); + canvas.drawBitmapRect(source_bitmap, scaled_bounds); return scaled_bitmap; } diff --git a/components/favicon_base/favicon_util.cc b/components/favicon_base/favicon_util.cc index dea071f..3f1196e 100644 --- a/components/favicon_base/favicon_util.cc +++ b/components/favicon_base/favicon_util.cc @@ -123,8 +123,7 @@ SkBitmap ResizeBitmapByDownsamplingIfPossible( SkCanvas canvas(bitmap); canvas.drawBitmapRect( - best_bitmap, NULL, - SkRect::MakeFromIRect(SkIRect::MakeWH(desired_size, desired_size))); + best_bitmap, SkRect::MakeIWH(desired_size, desired_size)); return bitmap; } return skia::ImageOperations::Resize(best_bitmap, diff --git a/components/favicon_base/select_favicon_frames.cc b/components/favicon_base/select_favicon_frames.cc index 1a1e526..f53e839 100644 --- a/components/favicon_base/select_favicon_frames.cc +++ b/components/favicon_base/select_favicon_frames.cc @@ -42,8 +42,7 @@ SkBitmap SampleNearestNeighbor(const SkBitmap& contents, int desired_size) { { SkCanvas canvas(bitmap); canvas.drawBitmapRect( - contents, NULL, - SkRect::MakeFromIRect(SkIRect::MakeWH(desired_size, desired_size))); + contents, SkRect::MakeIWH(desired_size, desired_size)); } return bitmap; diff --git a/content/browser/devtools/protocol/color_picker.cc b/content/browser/devtools/protocol/color_picker.cc index 23d79a6..0e43b50 100644 --- a/content/browser/devtools/protocol/color_picker.cc +++ b/content/browser/devtools/protocol/color_picker.cc @@ -215,7 +215,7 @@ void ColorPicker::UpdateCursor() { last_cursor_y_ - pixel_count / 2, pixel_count, pixel_count); SkRect dst_rect = SkRect::MakeXYWH(padding, padding, kDiameter, kDiameter); - canvas.drawBitmapRectToRect(frame_, &src_rect, dst_rect); + canvas.drawBitmapRect(frame_, &src_rect, dst_rect, NULL); // Paint grid. paint.setStrokeWidth(1); diff --git a/content/renderer/media/android/webmediaplayer_android.cc b/content/renderer/media/android/webmediaplayer_android.cc index 8731ed2..4097172 100644 --- a/content/renderer/media/android/webmediaplayer_android.cc +++ b/content/renderer/media/android/webmediaplayer_android.cc @@ -642,7 +642,7 @@ void WebMediaPlayerAndroid::paint(blink::WebCanvas* canvas, paint.setXfermodeMode(mode); // It is not necessary to pass the dest into the drawBitmap call since all // the context have been set up before calling paintCurrentFrameInContext. - canvas->drawBitmapRect(bitmap_, 0, dest, &paint); + canvas->drawBitmapRect(bitmap_, dest, &paint); } bool WebMediaPlayerAndroid::copyVideoTextureToPlatformTexture( diff --git a/content/renderer/npapi/webplugin_delegate_proxy.cc b/content/renderer/npapi/webplugin_delegate_proxy.cc index e5dae21..0ba60f2 100644 --- a/content/renderer/npapi/webplugin_delegate_proxy.cc +++ b/content/renderer/npapi/webplugin_delegate_proxy.cc @@ -697,7 +697,7 @@ void WebPluginDelegateProxy::Paint(SkCanvas* canvas, SkPaint paint; paint.setXfermodeMode( transparent_ ? SkXfermode::kSrcATop_Mode : SkXfermode::kSrc_Mode); - SkIRect src_rect = gfx::RectToSkIRect(offset_rect); + SkRect src_rect = gfx::RectToSkRect(offset_rect); canvas->drawBitmapRect(bitmap, &src_rect, gfx::RectToSkRect(rect), diff --git a/content/renderer/pepper/pepper_graphics_2d_host.cc b/content/renderer/pepper/pepper_graphics_2d_host.cc index 8b7bd42..bdb0552 100644 --- a/content/renderer/pepper/pepper_graphics_2d_host.cc +++ b/content/renderer/pepper/pepper_graphics_2d_host.cc @@ -284,7 +284,7 @@ bool PepperGraphics2DHost::ReadImageData(PP_Resource image, SkPaint paint; paint.setXfermodeMode(SkXfermode::kSrc_Mode); dest_canvas->drawBitmapRect( - *image_data_->GetMappedBitmap(), &src_irect, dest_rect, &paint); + *image_data_->GetMappedBitmap(), src_irect, dest_rect, &paint); } return true; } @@ -731,7 +731,7 @@ void PepperGraphics2DHost::ExecutePaintImageData(PPB_ImageData_Impl* image, SkPaint paint; paint.setXfermodeMode(SkXfermode::kSrc_Mode); backing_canvas->drawBitmapRect( - *image->GetMappedBitmap(), &src_irect, dest_rect, &paint); + *image->GetMappedBitmap(), src_irect, dest_rect, &paint); } } diff --git a/skia/config/SkUserConfig.h b/skia/config/SkUserConfig.h index 8d9dd33..3203e3f 100644 --- a/skia/config/SkUserConfig.h +++ b/skia/config/SkUserConfig.h @@ -230,10 +230,6 @@ SK_API void SkDebugf_FileLine(const char* file, int line, bool fatal, # define SK_LEGACY_IMAGE_GENERATOR_ENUMS_AND_OPTIONS #endif -#ifndef SK_SUPPORT_LEGACY_DRAWBITMAPRECTFLAGS_TYPE -# define SK_SUPPORT_LEGACY_DRAWBITMAPRECTFLAGS_TYPE -#endif - #ifndef SK_LEGACY_IMAGE_FILTER_CROP_RECT_EDGES # define SK_LEGACY_IMAGE_FILTER_CROP_RECT_EDGES #endif diff --git a/ui/gfx/canvas.cc b/ui/gfx/canvas.cc index 0c4a5a0..009bbd2 100644 --- a/ui/gfx/canvas.cc +++ b/ui/gfx/canvas.cc @@ -597,7 +597,7 @@ void Canvas::DrawImageIntHelper(const ImageSkia& image, // shift. SkIRect src_rect = { src_x, src_y, src_x + src_w, src_y + src_h }; const SkBitmap& bitmap = image_rep.sk_bitmap(); - canvas_->drawBitmapRect(bitmap, &src_rect, dest_rect, &paint); + canvas_->drawBitmapRect(bitmap, src_rect, dest_rect, &paint); return; } diff --git a/ui/ozone/platform/drm/gpu/drm_window.cc b/ui/ozone/platform/drm/gpu/drm_window.cc index 3dda06c..3e92f40 100644 --- a/ui/ozone/platform/drm/gpu/drm_window.cc +++ b/ui/ozone/platform/drm/gpu/drm_window.cc @@ -42,7 +42,7 @@ void UpdateCursorImage(DrmBuffer* cursor, const SkBitmap& image) { clip.set(0, 0, canvas->getDeviceSize().width(), canvas->getDeviceSize().height()); canvas->clipRect(clip, SkRegion::kReplace_Op); - canvas->drawBitmapRectToRect(image, &damage, damage); + canvas->drawBitmapRect(image, damage); } } // namespace |