diff options
41 files changed, 220 insertions, 222 deletions
diff --git a/chrome/browser/extensions/api/capture_web_contents_function.cc b/chrome/browser/extensions/api/capture_web_contents_function.cc index ae2bdbb..5b01e82 100644 --- a/chrome/browser/extensions/api/capture_web_contents_function.cc +++ b/chrome/browser/extensions/api/capture_web_contents_function.cc @@ -77,7 +77,7 @@ bool CaptureWebContentsFunction::RunAsync() { view->GetViewBounds().size(), base::Bind(&CaptureWebContentsFunction::CopyFromBackingStoreComplete, this), - SkBitmap::kARGB_8888_Config); + kN32_SkColorType); return true; } diff --git a/chrome/browser/thumbnails/thumbnail_tab_helper.cc b/chrome/browser/thumbnails/thumbnail_tab_helper.cc index 7206373..30d692f 100644 --- a/chrome/browser/thumbnails/thumbnail_tab_helper.cc +++ b/chrome/browser/thumbnails/thumbnail_tab_helper.cc @@ -108,7 +108,7 @@ void AsyncProcessThumbnail(content::WebContents* web_contents, copy_rect, context->requested_copy_size, base::Bind(&ProcessCapturedBitmap, context, algorithm), - SkBitmap::kARGB_8888_Config); + kN32_SkColorType); } } // namespace diff --git a/chrome/browser/ui/pdf/pdf_browsertest.cc b/chrome/browser/ui/pdf/pdf_browsertest.cc index c4f04a6..67d7664 100644 --- a/chrome/browser/ui/pdf/pdf_browsertest.cc +++ b/chrome/browser/ui/pdf/pdf_browsertest.cc @@ -96,7 +96,7 @@ class PDFBrowserTest : public InProcessBrowserTest, gfx::Rect(), gfx::Size(), base::Bind(&PDFBrowserTest::CopyFromBackingStoreCallback, this), - SkBitmap::kARGB_8888_Config); + kN32_SkColorType); content::RunMessageLoop(); diff --git a/content/browser/android/content_readback_handler.cc b/content/browser/android/content_readback_handler.cc index 841ef5f..601e3a3 100644 --- a/content/browser/android/content_readback_handler.cc +++ b/content/browser/android/content_readback_handler.cc @@ -54,7 +54,7 @@ void ContentReadbackHandler::GetContentBitmap(JNIEnv* env, jobject obj, jint readback_id, jfloat scale, - jobject config, + jobject color_type, jfloat x, jfloat y, jfloat width, @@ -70,7 +70,7 @@ void ContentReadbackHandler::GetContentBitmap(JNIEnv* env, readback_id); view->GetScaledContentBitmap( - scale, config, gfx::Rect(x, y, width, height), result_callback); + scale, color_type, gfx::Rect(x, y, width, height), result_callback); } void ContentReadbackHandler::GetCompositorBitmap(JNIEnv* env, diff --git a/content/browser/android/content_view_core_impl.cc b/content/browser/android/content_view_core_impl.cc index b45399f..5569975 100644 --- a/content/browser/android/content_view_core_impl.cc +++ b/content/browser/android/content_view_core_impl.cc @@ -638,8 +638,8 @@ void ContentViewCoreImpl::GetScaledContentBitmap( result_callback.Run(false, SkBitmap()); return; } - SkBitmap::Config skbitmap_format = gfx::ConvertToSkiaConfig(jbitmap_config); - view->GetScaledContentBitmap(scale, skbitmap_format, src_subrect, + SkColorType color_type = gfx::ConvertToSkiaColorType(jbitmap_config); + view->GetScaledContentBitmap(scale, color_type, src_subrect, result_callback); } diff --git a/content/browser/compositor/delegated_frame_host.cc b/content/browser/compositor/delegated_frame_host.cc index 84d42b2..91c8e03 100644 --- a/content/browser/compositor/delegated_frame_host.cc +++ b/content/browser/compositor/delegated_frame_host.cc @@ -120,10 +120,10 @@ void DelegatedFrameHost::CopyFromCompositingSurface( const gfx::Rect& src_subrect, const gfx::Size& dst_size, const base::Callback<void(bool, const SkBitmap&)>& callback, - const SkBitmap::Config config) { + const SkColorType color_type) { // Only ARGB888 and RGB565 supported as of now. - bool format_support = ((config == SkBitmap::kRGB_565_Config) || - (config == SkBitmap::kARGB_8888_Config)); + bool format_support = ((color_type == kRGB_565_SkColorType) || + (color_type == kN32_SkColorType)); DCHECK(format_support); if (!CanCopyToBitmap()) { callback.Run(false, SkBitmap()); @@ -136,7 +136,7 @@ void DelegatedFrameHost::CopyFromCompositingSurface( cc::CopyOutputRequest::CreateRequest(base::Bind( &DelegatedFrameHost::CopyFromCompositingSurfaceHasResult, dst_size_in_pixel, - config, + color_type, callback)); gfx::Rect src_subrect_in_pixel = ConvertRectToPixel(client_->CurrentDeviceScaleFactor(), src_subrect); @@ -429,7 +429,7 @@ void DelegatedFrameHost::EvictDelegatedFrame() { // static void DelegatedFrameHost::CopyFromCompositingSurfaceHasResult( const gfx::Size& dst_size_in_pixel, - const SkBitmap::Config config, + const SkColorType color_type, const base::Callback<void(bool, const SkBitmap&)>& callback, scoped_ptr<cc::CopyOutputResult> result) { if (result->IsEmpty() || result->size().IsEmpty()) { @@ -438,14 +438,14 @@ void DelegatedFrameHost::CopyFromCompositingSurfaceHasResult( } if (result->HasTexture()) { - PrepareTextureCopyOutputResult(dst_size_in_pixel, config, + PrepareTextureCopyOutputResult(dst_size_in_pixel, color_type, callback, result.Pass()); return; } DCHECK(result->HasBitmap()); - PrepareBitmapCopyOutputResult(dst_size_in_pixel, config, callback, + PrepareBitmapCopyOutputResult(dst_size_in_pixel, color_type, callback, result.Pass()); } @@ -471,7 +471,7 @@ static void CopyFromCompositingSurfaceFinished( // static void DelegatedFrameHost::PrepareTextureCopyOutputResult( const gfx::Size& dst_size_in_pixel, - const SkBitmap::Config config, + const SkColorType color_type, const base::Callback<void(bool, const SkBitmap&)>& callback, scoped_ptr<cc::CopyOutputResult> result) { DCHECK(result->HasTexture()); @@ -479,7 +479,6 @@ void DelegatedFrameHost::PrepareTextureCopyOutputResult( base::Bind(callback, false, SkBitmap())); scoped_ptr<SkBitmap> bitmap(new SkBitmap); - SkColorType color_type = SkBitmapConfigToColorType(config); if (!bitmap->allocPixels(SkImageInfo::Make(dst_size_in_pixel.width(), dst_size_in_pixel.height(), color_type, @@ -509,7 +508,7 @@ void DelegatedFrameHost::PrepareTextureCopyOutputResult( gfx::Rect(result->size()), dst_size_in_pixel, pixels, - config, + color_type, base::Bind(&CopyFromCompositingSurfaceFinished, callback, base::Passed(&release_callback), @@ -521,10 +520,10 @@ void DelegatedFrameHost::PrepareTextureCopyOutputResult( // static void DelegatedFrameHost::PrepareBitmapCopyOutputResult( const gfx::Size& dst_size_in_pixel, - const SkBitmap::Config config, + const SkColorType color_type, const base::Callback<void(bool, const SkBitmap&)>& callback, scoped_ptr<cc::CopyOutputResult> result) { - if (config != SkBitmap::kARGB_8888_Config) { + if (color_type != kN32_SkColorType) { NOTIMPLEMENTED(); callback.Run(false, SkBitmap()); return; diff --git a/content/browser/compositor/delegated_frame_host.h b/content/browser/compositor/delegated_frame_host.h index bcbc758..3efe186 100644 --- a/content/browser/compositor/delegated_frame_host.h +++ b/content/browser/compositor/delegated_frame_host.h @@ -95,7 +95,7 @@ class CONTENT_EXPORT DelegatedFrameHost const gfx::Rect& src_subrect, const gfx::Size& dst_size, const base::Callback<void(bool, const SkBitmap&)>& callback, - const SkBitmap::Config config); + const SkColorType color_type); void CopyFromCompositingSurfaceToVideoFrame( const gfx::Rect& src_subrect, const scoped_refptr<media::VideoFrame>& target, @@ -172,17 +172,17 @@ class CONTENT_EXPORT DelegatedFrameHost // of the copy. static void CopyFromCompositingSurfaceHasResult( const gfx::Size& dst_size_in_pixel, - const SkBitmap::Config config, + const SkColorType color_type, const base::Callback<void(bool, const SkBitmap&)>& callback, scoped_ptr<cc::CopyOutputResult> result); static void PrepareTextureCopyOutputResult( const gfx::Size& dst_size_in_pixel, - const SkBitmap::Config config, + const SkColorType color_type, const base::Callback<void(bool, const SkBitmap&)>& callback, scoped_ptr<cc::CopyOutputResult> result); static void PrepareBitmapCopyOutputResult( const gfx::Size& dst_size_in_pixel, - const SkBitmap::Config config, + const SkColorType color_type, const base::Callback<void(bool, const SkBitmap&)>& callback, scoped_ptr<cc::CopyOutputResult> result); static void CopyFromCompositingSurfaceHasResultForVideo( diff --git a/content/browser/devtools/renderer_overrides_handler.cc b/content/browser/devtools/renderer_overrides_handler.cc index d5e8516..3f53596 100644 --- a/content/browser/devtools/renderer_overrides_handler.cc +++ b/content/browser/devtools/renderer_overrides_handler.cc @@ -264,7 +264,7 @@ void RendererOverridesHandler::InnerSwapCompositorFrame() { base::Bind(&RendererOverridesHandler::ScreencastFrameCaptured, weak_factory_.GetWeakPtr(), format, quality, last_compositor_frame_metadata_), - SkBitmap::kARGB_8888_Config); + kN32_SkColorType); } } diff --git a/content/browser/frame_host/navigation_entry_screenshot_manager.cc b/content/browser/frame_host/navigation_entry_screenshot_manager.cc index 8af8f63..06074fd 100644 --- a/content/browser/frame_host/navigation_entry_screenshot_manager.cc +++ b/content/browser/frame_host/navigation_entry_screenshot_manager.cc @@ -130,7 +130,7 @@ void NavigationEntryScreenshotManager::TakeScreenshotImpl( NavigationEntryImpl* entry) { DCHECK(host && host->GetView()); DCHECK(entry); - SkBitmap::Config preferred_format = host->PreferredReadbackFormat(); + SkColorType preferred_format = host->PreferredReadbackFormat(); host->CopyFromBackingStore( gfx::Rect(), host->GetView()->GetViewBounds().size(), diff --git a/content/browser/frame_host/render_widget_host_view_child_frame.cc b/content/browser/frame_host/render_widget_host_view_child_frame.cc index d9e32c9..91b695b 100644 --- a/content/browser/frame_host/render_widget_host_view_child_frame.cc +++ b/content/browser/frame_host/render_widget_host_view_child_frame.cc @@ -289,7 +289,7 @@ void RenderWidgetHostViewChildFrame::CopyFromCompositingSurface( const gfx::Rect& src_subrect, const gfx::Size& /* dst_size */, const base::Callback<void(bool, const SkBitmap&)>& callback, - const SkBitmap::Config config) { + const SkColorType color_type) { callback.Run(false, SkBitmap()); } @@ -332,8 +332,8 @@ gfx::NativeViewId RenderWidgetHostViewChildFrame::GetParentForWindowlessPlugin() } #endif // defined(OS_WIN) -SkBitmap::Config RenderWidgetHostViewChildFrame::PreferredReadbackFormat() { - return SkBitmap::kARGB_8888_Config; +SkColorType RenderWidgetHostViewChildFrame::PreferredReadbackFormat() { + return kN32_SkColorType; } } // namespace content diff --git a/content/browser/frame_host/render_widget_host_view_child_frame.h b/content/browser/frame_host/render_widget_host_view_child_frame.h index e288248..3825ef0 100644 --- a/content/browser/frame_host/render_widget_host_view_child_frame.h +++ b/content/browser/frame_host/render_widget_host_view_child_frame.h @@ -89,7 +89,7 @@ class CONTENT_EXPORT RenderWidgetHostViewChildFrame const gfx::Rect& src_subrect, const gfx::Size& dst_size, const base::Callback<void(bool, const SkBitmap&)>& callback, - const SkBitmap::Config config) OVERRIDE; + const SkColorType color_type) OVERRIDE; virtual void CopyFromCompositingSurfaceToVideoFrame( const gfx::Rect& src_subrect, const scoped_refptr<media::VideoFrame>& target, @@ -152,7 +152,7 @@ class CONTENT_EXPORT RenderWidgetHostViewChildFrame virtual gfx::NativeViewId GetParentForWindowlessPlugin() const OVERRIDE; #endif - virtual SkBitmap::Config PreferredReadbackFormat() OVERRIDE; + virtual SkColorType PreferredReadbackFormat() OVERRIDE; protected: friend class RenderWidgetHostView; diff --git a/content/browser/frame_host/render_widget_host_view_guest.cc b/content/browser/frame_host/render_widget_host_view_guest.cc index 8a02c69..cc27520 100644 --- a/content/browser/frame_host/render_widget_host_view_guest.cc +++ b/content/browser/frame_host/render_widget_host_view_guest.cc @@ -354,7 +354,7 @@ void RenderWidgetHostViewGuest::CopyFromCompositingSurface( const gfx::Rect& src_subrect, const gfx::Size& dst_size, const base::Callback<void(bool, const SkBitmap&)>& callback, - const SkBitmap::Config config) { + const SkColorType color_type) { CHECK(guest_); guest_->CopyFromCompositingSurface(src_subrect, dst_size, callback); } @@ -544,8 +544,8 @@ void RenderWidgetHostViewGuest::ProcessGestures( } } -SkBitmap::Config RenderWidgetHostViewGuest::PreferredReadbackFormat() { - return SkBitmap::kARGB_8888_Config; +SkColorType RenderWidgetHostViewGuest::PreferredReadbackFormat() { + return kN32_SkColorType; } RenderWidgetHostViewBase* diff --git a/content/browser/frame_host/render_widget_host_view_guest.h b/content/browser/frame_host/render_widget_host_view_guest.h index 6132b4e..bc3469d 100644 --- a/content/browser/frame_host/render_widget_host_view_guest.h +++ b/content/browser/frame_host/render_widget_host_view_guest.h @@ -91,7 +91,7 @@ class CONTENT_EXPORT RenderWidgetHostViewGuest const gfx::Rect& src_subrect, const gfx::Size& dst_size, const base::Callback<void(bool, const SkBitmap&)>& callback, - const SkBitmap::Config config) OVERRIDE; + const SkColorType color_type) OVERRIDE; virtual void AcceleratedSurfaceBuffersSwapped( const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params, int gpu_host_id) OVERRIDE; @@ -146,7 +146,7 @@ class CONTENT_EXPORT RenderWidgetHostViewGuest virtual void DispatchGestureEvent(ui::GestureEvent* event) OVERRIDE; virtual void DispatchCancelTouchEvent(ui::TouchEvent* event) OVERRIDE; - virtual SkBitmap::Config PreferredReadbackFormat() OVERRIDE; + virtual SkColorType PreferredReadbackFormat() OVERRIDE; protected: friend class RenderWidgetHostView; diff --git a/content/browser/media/capture/web_contents_video_capture_device.cc b/content/browser/media/capture/web_contents_video_capture_device.cc index 8a8474c..9824849 100644 --- a/content/browser/media/capture/web_contents_video_capture_device.cc +++ b/content/browser/media/capture/web_contents_video_capture_device.cc @@ -469,7 +469,7 @@ void RenderVideoFrame(const SkBitmap& input, // Sanity-check the captured bitmap. if (input.empty() || !input.readyToDraw() || - input.config() != SkBitmap::kARGB_8888_Config || + input.colorType() != kN32_SkColorType || input.width() < 2 || input.height() < 2) { DVLOG(1) << "input unacceptable (size=" << input.getSize() @@ -667,7 +667,7 @@ void WebContentsCaptureMachine::Capture( start_time, target, deliver_frame_cb), - SkBitmap::kARGB_8888_Config); + kN32_SkColorType); } } diff --git a/content/browser/media/capture/web_contents_video_capture_device_unittest.cc b/content/browser/media/capture/web_contents_video_capture_device_unittest.cc index dc1bd5a..fde3706 100644 --- a/content/browser/media/capture/web_contents_video_capture_device_unittest.cc +++ b/content/browser/media/capture/web_contents_video_capture_device_unittest.cc @@ -249,7 +249,7 @@ class CaptureTestRenderViewHost : public TestRenderViewHost { const gfx::Rect& src_rect, const gfx::Size& accelerated_dst_size, const base::Callback<void(bool, const SkBitmap&)>& callback, - const SkBitmap::Config& bitmap_config) OVERRIDE { + const SkColorType color_type) OVERRIDE { gfx::Size size = controller_->GetCopyResultSize(); SkColor color = controller_->GetSolidColor(); diff --git a/content/browser/renderer_host/compositing_iosurface_transformer_mac_unittest.cc b/content/browser/renderer_host/compositing_iosurface_transformer_mac_unittest.cc index 8772793..8e909fd 100644 --- a/content/browser/renderer_host/compositing_iosurface_transformer_mac_unittest.cc +++ b/content/browser/renderer_host/compositing_iosurface_transformer_mac_unittest.cc @@ -212,8 +212,8 @@ int ImageDifference(const SkBitmap& expected, const SkBitmap& actual) { // Sanity-check assumed image properties. DCHECK_EQ(expected.width(), actual.width()); DCHECK_EQ(expected.height(), actual.height()); - DCHECK_EQ(SkBitmap::kARGB_8888_Config, expected.config()); - DCHECK_EQ(SkBitmap::kARGB_8888_Config, actual.config()); + DCHECK_EQ(kN32_SkColorType, expected.colorType()); + DCHECK_EQ(kN32_SkColorType, actual.colorType()); // Compare both images. int num_pixels_different = 0; diff --git a/content/browser/renderer_host/render_widget_host_impl.cc b/content/browser/renderer_host/render_widget_host_impl.cc index 017438d..991e230 100644 --- a/content/browser/renderer_host/render_widget_host_impl.cc +++ b/content/browser/renderer_host/render_widget_host_impl.cc @@ -678,14 +678,14 @@ void RenderWidgetHostImpl::CopyFromBackingStore( const gfx::Rect& src_subrect, const gfx::Size& accelerated_dst_size, const base::Callback<void(bool, const SkBitmap&)>& callback, - const SkBitmap::Config& bitmap_config) { + const SkColorType color_type) { if (view_) { TRACE_EVENT0("browser", "RenderWidgetHostImpl::CopyFromBackingStore::FromCompositingSurface"); gfx::Rect accelerated_copy_rect = src_subrect.IsEmpty() ? gfx::Rect(view_->GetViewBounds().size()) : src_subrect; view_->CopyFromCompositingSurface( - accelerated_copy_rect, accelerated_dst_size, callback, bitmap_config); + accelerated_copy_rect, accelerated_dst_size, callback, color_type); return; } @@ -2381,10 +2381,10 @@ void RenderWidgetHostImpl::AddLatencyInfoComponentIds( } } -SkBitmap::Config RenderWidgetHostImpl::PreferredReadbackFormat() { +SkColorType RenderWidgetHostImpl::PreferredReadbackFormat() { if (view_) return view_->PreferredReadbackFormat(); - return SkBitmap::kARGB_8888_Config; + return kN32_SkColorType; } } // namespace content diff --git a/content/browser/renderer_host/render_widget_host_impl.h b/content/browser/renderer_host/render_widget_host_impl.h index 2d1ed58..f72ce43 100644 --- a/content/browser/renderer_host/render_widget_host_impl.h +++ b/content/browser/renderer_host/render_widget_host_impl.h @@ -136,7 +136,7 @@ class CONTENT_EXPORT RenderWidgetHostImpl const gfx::Rect& src_rect, const gfx::Size& accelerated_dst_size, const base::Callback<void(bool, const SkBitmap&)>& callback, - const SkBitmap::Config& bitmap_config) OVERRIDE; + const SkColorType color_type) OVERRIDE; virtual bool CanCopyFromBackingStore() OVERRIDE; #if defined(OS_ANDROID) virtual void LockBackingStore() OVERRIDE; @@ -173,7 +173,7 @@ class CONTENT_EXPORT RenderWidgetHostImpl const MouseEventCallback& callback) OVERRIDE; virtual void GetWebScreenInfo(blink::WebScreenInfo* result) OVERRIDE; - virtual SkBitmap::Config PreferredReadbackFormat() OVERRIDE; + virtual SkColorType PreferredReadbackFormat() OVERRIDE; // BrowserAccessibilityDelegate virtual void AccessibilitySetFocus(int acc_obj_id) OVERRIDE; diff --git a/content/browser/renderer_host/render_widget_host_view_android.cc b/content/browser/renderer_host/render_widget_host_view_android.cc index 0175632..a0e4dda 100644 --- a/content/browser/renderer_host/render_widget_host_view_android.cc +++ b/content/browser/renderer_host/render_widget_host_view_android.cc @@ -291,7 +291,7 @@ void RenderWidgetHostViewAndroid::SetBounds(const gfx::Rect& rect) { void RenderWidgetHostViewAndroid::GetScaledContentBitmap( float scale, - SkBitmap::Config bitmap_config, + SkColorType color_type, gfx::Rect src_subrect, const base::Callback<void(bool, const SkBitmap&)>& result_callback) { if (!IsSurfaceAvailableForCopy()) { @@ -311,7 +311,7 @@ void RenderWidgetHostViewAndroid::GetScaledContentBitmap( gfx::Size dst_size( gfx::ToCeiledSize(gfx::ScaleSize(bounds, scale / device_scale_factor))); CopyFromCompositingSurface( - src_subrect, dst_size, result_callback, bitmap_config); + src_subrect, dst_size, result_callback, color_type); } bool RenderWidgetHostViewAndroid::HasValidFrame() const { @@ -664,8 +664,8 @@ void RenderWidgetHostViewAndroid::CopyFromCompositingSurface( const gfx::Rect& src_subrect, const gfx::Size& dst_size, const base::Callback<void(bool, const SkBitmap&)>& callback, - const SkBitmap::Config bitmap_config) { - if (!IsReadbackConfigSupported(bitmap_config)) { + const SkColorType color_type) { + if (!IsReadbackConfigSupported(color_type)) { callback.Run(false, SkBitmap()); return; } @@ -684,7 +684,7 @@ void RenderWidgetHostViewAndroid::CopyFromCompositingSurface( if (using_synchronous_compositor_) { SynchronousCopyContents(src_subrect_in_pixel, dst_size_in_pixel, callback, - bitmap_config); + color_type); UMA_HISTOGRAM_TIMES("Compositing.CopyFromSurfaceTimeSynchronous", base::TimeTicks::Now() - start_time); return; @@ -711,7 +711,7 @@ void RenderWidgetHostViewAndroid::CopyFromCompositingSurface( base::Bind(&RenderWidgetHostViewAndroid:: PrepareTextureCopyOutputResultForDelegatedReadback, dst_size_in_pixel, - bitmap_config, + color_type, start_time, readback_layer, callback)); @@ -955,7 +955,7 @@ void RenderWidgetHostViewAndroid::SynchronousCopyContents( const gfx::Rect& src_subrect_in_pixel, const gfx::Size& dst_size_in_pixel, const base::Callback<void(bool, const SkBitmap&)>& callback, - const SkBitmap::Config config) { + const SkColorType color_type) { SynchronousCompositor* compositor = SynchronousCompositorImpl::FromID(host_->GetProcess()->GetID(), host_->GetRoutingID()); @@ -967,7 +967,7 @@ void RenderWidgetHostViewAndroid::SynchronousCopyContents( SkBitmap bitmap; bitmap.allocPixels(SkImageInfo::Make(dst_size_in_pixel.width(), dst_size_in_pixel.height(), - SkBitmapConfigToColorType(config), + color_type, kPremul_SkAlphaType)); SkCanvas canvas(bitmap); canvas.scale( @@ -1355,20 +1355,20 @@ void RenderWidgetHostViewAndroid::OnLostResources() { void RenderWidgetHostViewAndroid::PrepareTextureCopyOutputResultForDelegatedReadback( const gfx::Size& dst_size_in_pixel, - const SkBitmap::Config config, + const SkColorType color_type, const base::TimeTicks& start_time, scoped_refptr<cc::Layer> readback_layer, const base::Callback<void(bool, const SkBitmap&)>& callback, scoped_ptr<cc::CopyOutputResult> result) { readback_layer->RemoveFromParent(); PrepareTextureCopyOutputResult( - dst_size_in_pixel, config, start_time, callback, result.Pass()); + dst_size_in_pixel, color_type, start_time, callback, result.Pass()); } // static void RenderWidgetHostViewAndroid::PrepareTextureCopyOutputResult( const gfx::Size& dst_size_in_pixel, - const SkBitmap::Config bitmap_config, + const SkColorType color_type, const base::TimeTicks& start_time, const base::Callback<void(bool, const SkBitmap&)>& callback, scoped_ptr<cc::CopyOutputResult> result) { @@ -1379,7 +1379,6 @@ void RenderWidgetHostViewAndroid::PrepareTextureCopyOutputResult( return; scoped_ptr<SkBitmap> bitmap(new SkBitmap); - SkColorType color_type = SkBitmapConfigToColorType(bitmap_config); if (!bitmap->allocPixels(SkImageInfo::Make(dst_size_in_pixel.width(), dst_size_in_pixel.height(), color_type, @@ -1413,7 +1412,7 @@ void RenderWidgetHostViewAndroid::PrepareTextureCopyOutputResult( gfx::Rect(result->size()), dst_size_in_pixel, pixels, - bitmap_config, + color_type, base::Bind(&CopyFromCompositingSurfaceFinished, callback, base::Passed(&release_callback), @@ -1424,24 +1423,24 @@ void RenderWidgetHostViewAndroid::PrepareTextureCopyOutputResult( } bool RenderWidgetHostViewAndroid::IsReadbackConfigSupported( - SkBitmap::Config bitmap_config) { + SkColorType color_type) { ImageTransportFactoryAndroid* factory = ImageTransportFactoryAndroid::GetInstance(); GLHelper* gl_helper = factory->GetGLHelper(); if (!gl_helper) return false; - return gl_helper->IsReadbackConfigSupported(bitmap_config); + return gl_helper->IsReadbackConfigSupported(color_type); } -SkBitmap::Config RenderWidgetHostViewAndroid::PreferredReadbackFormat() { +SkColorType RenderWidgetHostViewAndroid::PreferredReadbackFormat() { // Define the criteria here. If say the 16 texture readback is // supported we should go with that (this degrades quality) // or stick back to the default format. if (base::SysInfo::IsLowEndDevice()) { - if (IsReadbackConfigSupported(SkBitmap::kRGB_565_Config)) - return SkBitmap::kRGB_565_Config; + if (IsReadbackConfigSupported(kRGB_565_SkColorType)) + return kRGB_565_SkColorType; } - return SkBitmap::kARGB_8888_Config; + return kN32_SkColorType; } void RenderWidgetHostViewAndroid::ShowSelectionHandlesAutomatically() { diff --git a/content/browser/renderer_host/render_widget_host_view_android.h b/content/browser/renderer_host/render_widget_host_view_android.h index bfdaeac..280009f 100644 --- a/content/browser/renderer_host/render_widget_host_view_android.h +++ b/content/browser/renderer_host/render_widget_host_view_android.h @@ -132,7 +132,7 @@ class CONTENT_EXPORT RenderWidgetHostViewAndroid const gfx::Rect& src_subrect, const gfx::Size& dst_size, const base::Callback<void(bool, const SkBitmap&)>& callback, - const SkBitmap::Config config) OVERRIDE; + const SkColorType color_type) OVERRIDE; virtual void CopyFromCompositingSurfaceToVideoFrame( const gfx::Rect& src_subrect, const scoped_refptr<media::VideoFrame>& target, @@ -186,7 +186,7 @@ class CONTENT_EXPORT RenderWidgetHostViewAndroid // DelegatedFrameEvictor implementation virtual void EvictDelegatedFrame() OVERRIDE; - virtual SkBitmap::Config PreferredReadbackFormat() OVERRIDE; + virtual SkColorType PreferredReadbackFormat() OVERRIDE; // GestureTextSelectorClient implementation. virtual void ShowSelectionHandlesAutomatically() OVERRIDE; @@ -220,7 +220,7 @@ class CONTENT_EXPORT RenderWidgetHostViewAndroid void GetScaledContentBitmap( float scale, - SkBitmap::Config bitmap_config, + SkColorType color_type, gfx::Rect src_subrect, const base::Callback<void(bool, const SkBitmap&)>& result_callback); @@ -261,13 +261,13 @@ class CONTENT_EXPORT RenderWidgetHostViewAndroid // of the copy. static void PrepareTextureCopyOutputResult( const gfx::Size& dst_size_in_pixel, - const SkBitmap::Config config, + const SkColorType color_type, const base::TimeTicks& start_time, const base::Callback<void(bool, const SkBitmap&)>& callback, scoped_ptr<cc::CopyOutputResult> result); static void PrepareTextureCopyOutputResultForDelegatedReadback( const gfx::Size& dst_size_in_pixel, - const SkBitmap::Config config, + const SkColorType color_type, const base::TimeTicks& start_time, scoped_refptr<cc::Layer> readback_layer, const base::Callback<void(bool, const SkBitmap&)>& callback, @@ -278,9 +278,9 @@ class CONTENT_EXPORT RenderWidgetHostViewAndroid const gfx::Rect& src_subrect_in_pixel, const gfx::Size& dst_size_in_pixel, const base::Callback<void(bool, const SkBitmap&)>& callback, - const SkBitmap::Config config); + const SkColorType color_type); - bool IsReadbackConfigSupported(SkBitmap::Config bitmap_config); + bool IsReadbackConfigSupported(SkColorType color_type); // If we have locks on a frame during a ContentViewCore swap or a context // lost, the frame is no longer valid and we can safely release all the locks. diff --git a/content/browser/renderer_host/render_widget_host_view_aura.cc b/content/browser/renderer_host/render_widget_host_view_aura.cc index fe64a52..42a80f1 100644 --- a/content/browser/renderer_host/render_widget_host_view_aura.cc +++ b/content/browser/renderer_host/render_widget_host_view_aura.cc @@ -934,9 +934,9 @@ void RenderWidgetHostViewAura::CopyFromCompositingSurface( const gfx::Rect& src_subrect, const gfx::Size& dst_size, const base::Callback<void(bool, const SkBitmap&)>& callback, - const SkBitmap::Config config) { + const SkColorType color_type) { delegated_frame_host_->CopyFromCompositingSurface( - src_subrect, dst_size, callback, config); + src_subrect, dst_size, callback, color_type); } void RenderWidgetHostViewAura::CopyFromCompositingSurfaceToVideoFrame( @@ -2419,8 +2419,8 @@ void RenderWidgetHostViewAura::ForwardKeyboardEvent( host_->ForwardKeyboardEvent(event); } -SkBitmap::Config RenderWidgetHostViewAura::PreferredReadbackFormat() { - return SkBitmap::kARGB_8888_Config; +SkColorType RenderWidgetHostViewAura::PreferredReadbackFormat() { + return kN32_SkColorType; } //////////////////////////////////////////////////////////////////////////////// diff --git a/content/browser/renderer_host/render_widget_host_view_aura.h b/content/browser/renderer_host/render_widget_host_view_aura.h index 637b9fd..84b4740 100644 --- a/content/browser/renderer_host/render_widget_host_view_aura.h +++ b/content/browser/renderer_host/render_widget_host_view_aura.h @@ -183,7 +183,7 @@ class CONTENT_EXPORT RenderWidgetHostViewAura const gfx::Rect& src_subrect, const gfx::Size& dst_size, const base::Callback<void(bool, const SkBitmap&)>& callback, - const SkBitmap::Config config) OVERRIDE; + const SkColorType color_type) OVERRIDE; virtual void CopyFromCompositingSurfaceToVideoFrame( const gfx::Rect& src_subrect, const scoped_refptr<media::VideoFrame>& target, @@ -345,7 +345,7 @@ class CONTENT_EXPORT RenderWidgetHostViewAura // Exposed for tests. aura::Window* window() { return window_; } - virtual SkBitmap::Config PreferredReadbackFormat() OVERRIDE; + virtual SkColorType PreferredReadbackFormat() OVERRIDE; virtual DelegatedFrameHost* GetDelegatedFrameHost() const OVERRIDE; private: diff --git a/content/browser/renderer_host/render_widget_host_view_base.cc b/content/browser/renderer_host/render_widget_host_view_base.cc index 8d801a6..c9d3ebb 100644 --- a/content/browser/renderer_host/render_widget_host_view_base.cc +++ b/content/browser/renderer_host/render_widget_host_view_base.cc @@ -595,8 +595,8 @@ void RenderWidgetHostViewBase::FlushInput() { impl->FlushInput(); } -SkBitmap::Config RenderWidgetHostViewBase::PreferredReadbackFormat() { - return SkBitmap::kARGB_8888_Config; +SkColorType RenderWidgetHostViewBase::PreferredReadbackFormat() { + return kN32_SkColorType; } gfx::Size RenderWidgetHostViewBase::GetVisibleViewportSize() const { diff --git a/content/browser/renderer_host/render_widget_host_view_base.h b/content/browser/renderer_host/render_widget_host_view_base.h index 25f551c6..8f84a99 100644 --- a/content/browser/renderer_host/render_widget_host_view_base.h +++ b/content/browser/renderer_host/render_widget_host_view_base.h @@ -160,7 +160,7 @@ class CONTENT_EXPORT RenderWidgetHostViewBase : public RenderWidgetHostView, virtual void AccessibilityShowMenu(int acc_obj_id); virtual gfx::Point AccessibilityOriginInScreen(const gfx::Rect& bounds); - virtual SkBitmap::Config PreferredReadbackFormat(); + virtual SkColorType PreferredReadbackFormat(); // Informs that the focused DOM node has changed. virtual void FocusedNodeChanged(bool is_editable_node) {} @@ -260,7 +260,7 @@ class CONTENT_EXPORT RenderWidgetHostViewBase : public RenderWidgetHostView, const gfx::Rect& src_subrect, const gfx::Size& dst_size, const base::Callback<void(bool, const SkBitmap&)>& callback, - const SkBitmap::Config config) = 0; + const SkColorType color_type) = 0; // Copies a given subset of the compositing surface's content into a YV12 // VideoFrame, and invokes a callback with a success/fail parameter. |target| diff --git a/content/browser/renderer_host/render_widget_host_view_browsertest.cc b/content/browser/renderer_host/render_widget_host_view_browsertest.cc index ae2b844..fb1eab3 100644 --- a/content/browser/renderer_host/render_widget_host_view_browsertest.cc +++ b/content/browser/renderer_host/render_widget_host_view_browsertest.cc @@ -157,7 +157,7 @@ class RenderWidgetHostViewBrowserTest : public ContentBrowserTest { &RenderWidgetHostViewBrowserTest::FinishCopyFromBackingStore, base::Unretained(this), run_loop.QuitClosure()), - SkBitmap::kARGB_8888_Config); + kN32_SkColorType); run_loop.Run(); if (frames_captured()) @@ -291,7 +291,7 @@ IN_PROC_BROWSER_TEST_P(CompositingRenderWidgetHostViewBrowserTest, base::Bind(&RenderWidgetHostViewBrowserTest::FinishCopyFromBackingStore, base::Unretained(this), run_loop.QuitClosure()), - SkBitmap::kARGB_8888_Config); + kN32_SkColorType); // Delete the surface before the callback is run. GetRenderWidgetHostView()->AcceleratedSurfaceRelease(); run_loop.Run(); @@ -637,7 +637,7 @@ class CompositingRenderWidgetHostViewBrowserTestTabCapture rwhvp->CopyFromCompositingSurface(copy_rect, output_size, callback, - SkBitmap::kARGB_8888_Config); + kN32_SkColorType); } run_loop.Run(); } diff --git a/content/browser/renderer_host/render_widget_host_view_mac.h b/content/browser/renderer_host/render_widget_host_view_mac.h index 36645c8..9cc3e85 100644 --- a/content/browser/renderer_host/render_widget_host_view_mac.h +++ b/content/browser/renderer_host/render_widget_host_view_mac.h @@ -296,7 +296,7 @@ class CONTENT_EXPORT RenderWidgetHostViewMac const gfx::Rect& src_subrect, const gfx::Size& dst_size, const base::Callback<void(bool, const SkBitmap&)>& callback, - SkBitmap::Config config) OVERRIDE; + SkColorType color_type) OVERRIDE; virtual void CopyFromCompositingSurfaceToVideoFrame( const gfx::Rect& src_subrect, const scoped_refptr<media::VideoFrame>& target, @@ -344,7 +344,7 @@ class CONTENT_EXPORT RenderWidgetHostViewMac uint32 output_surface_id, unsigned frame_id) OVERRIDE; virtual void ReleaseReferencesToSoftwareFrame() OVERRIDE; - virtual SkBitmap::Config PreferredReadbackFormat() OVERRIDE; + virtual SkColorType PreferredReadbackFormat() OVERRIDE; // CompositingIOSurfaceLayerClient implementation. virtual void AcceleratedLayerDidDrawFrame(bool succeeded) OVERRIDE; diff --git a/content/browser/renderer_host/render_widget_host_view_mac.mm b/content/browser/renderer_host/render_widget_host_view_mac.mm index 56da882..a4395d1 100644 --- a/content/browser/renderer_host/render_widget_host_view_mac.mm +++ b/content/browser/renderer_host/render_widget_host_view_mac.mm @@ -1211,14 +1211,14 @@ void RenderWidgetHostViewMac::CopyFromCompositingSurface( const gfx::Rect& src_subrect, const gfx::Size& dst_size, const base::Callback<void(bool, const SkBitmap&)>& callback, - const SkBitmap::Config config) { + const SkColorType color_type) { if (delegated_frame_host_) { delegated_frame_host_->CopyFromCompositingSurface( - src_subrect, dst_size, callback, config); + src_subrect, dst_size, callback, color_type); return; } - if (config != SkBitmap::kARGB_8888_Config) { + if (color_type != kN32_SkColorType) { NOTIMPLEMENTED(); callback.Run(false, SkBitmap()); } @@ -2262,8 +2262,8 @@ void RenderWidgetHostViewMac::LayoutLayers() { } } -SkBitmap::Config RenderWidgetHostViewMac::PreferredReadbackFormat() { - return SkBitmap::kARGB_8888_Config; +SkColorType RenderWidgetHostViewMac::PreferredReadbackFormat() { + return kN32_SkColorType; } //////////////////////////////////////////////////////////////////////////////// diff --git a/content/common/gpu/client/gl_helper.cc b/content/common/gpu/client/gl_helper.cc index c61737b..dfdeff0 100644 --- a/content/common/gpu/client/gl_helper.cc +++ b/content/common/gpu/client/gl_helper.cc @@ -141,19 +141,19 @@ class GLHelper::CopyTextureToImpl const gfx::Rect& src_subrect, const gfx::Size& dst_size, unsigned char* out, - const SkBitmap::Config config, + const SkColorType color_type, const base::Callback<void(bool)>& callback, GLHelper::ScalerQuality quality); void ReadbackTextureSync(GLuint texture, const gfx::Rect& src_rect, unsigned char* out, - SkBitmap::Config format); + SkColorType format); void ReadbackTextureAsync(GLuint texture, const gfx::Size& dst_size, unsigned char* out, - SkBitmap::Config config, + SkColorType color_type, const base::Callback<void(bool)>& callback); // Reads back bytes from the currently bound frame buffer. @@ -162,7 +162,7 @@ class GLHelper::CopyTextureToImpl int32 bytes_per_row, // generally dst_size.width() * 4 int32 row_stride_bytes, // generally dst_size.width() * 4 unsigned char* out, - const SkBitmap::Config config, + const SkColorType color_type, ReadbackSwizzle swizzle, const base::Callback<void(bool)>& callback); @@ -193,7 +193,7 @@ class GLHelper::CopyTextureToImpl // 0 if GL_EXT_draw_buffers is not available. GLint MaxDrawBuffers() const { return max_draw_buffers_; } - bool IsReadbackConfigSupported(SkBitmap::Config bitmap_config); + bool IsReadbackConfigSupported(SkColorType color_type); private: // A single request to CropScaleReadbackAndCleanTexture. @@ -316,7 +316,7 @@ class GLHelper::CopyTextureToImpl const gfx::Size& dst_size, bool vertically_flip_texture, bool swizzle, - SkBitmap::Config config, + SkColorType color_type, GLHelper::ScalerQuality quality); static void nullcallback(bool success) {} @@ -362,9 +362,9 @@ GLuint GLHelper::CopyTextureToImpl::ScaleTexture( const gfx::Size& dst_size, bool vertically_flip_texture, bool swizzle, - SkBitmap::Config bitmap_config, + SkColorType color_type, GLHelper::ScalerQuality quality) { - if (!IsReadbackConfigSupported(bitmap_config)) + if (!IsReadbackConfigSupported(color_type)) return 0; scoped_ptr<ScalerInterface> scaler( @@ -381,11 +381,11 @@ GLuint GLHelper::CopyTextureToImpl::ScaleTexture( gl_->GenTextures(1, &dst_texture); { ScopedTextureBinder<GL_TEXTURE_2D> texture_binder(gl_, dst_texture); - switch (bitmap_config) { - case SkBitmap::kARGB_8888_Config: + switch (color_type) { + case kN32_SkColorType: // Do nothing params already set. break; - case SkBitmap::kRGB_565_Config: + case kRGB_565_SkColorType: format = GL_RGB; type = GL_UNSIGNED_SHORT_5_6_5; break; @@ -412,10 +412,10 @@ void GLHelper::CopyTextureToImpl::ReadbackAsync( int32 bytes_per_row, int32 row_stride_bytes, unsigned char* out, - const SkBitmap::Config bitmap_config, + const SkColorType color_type, ReadbackSwizzle swizzle, const base::Callback<void(bool)>& callback) { - if (!IsReadbackConfigSupported(bitmap_config)) { + if (!IsReadbackConfigSupported(color_type)) { callback.Run(false); return; } @@ -428,12 +428,12 @@ void GLHelper::CopyTextureToImpl::ReadbackAsync( GLenum format = GL_RGBA, type = GL_UNSIGNED_BYTE; int bytes_per_pixel = 4; - switch (bitmap_config) { - case SkBitmap::kARGB_8888_Config: + switch (color_type) { + case kN32_SkColorType: if (swizzle == kSwizzleBGRA) format = GL_BGRA_EXT; break; - case SkBitmap::kRGB_565_Config: + case kRGB_565_SkColorType: format = GL_RGB; type = GL_UNSIGNED_SHORT_5_6_5; bytes_per_pixel = 2; @@ -472,10 +472,10 @@ void GLHelper::CopyTextureToImpl::CropScaleReadbackAndCleanTexture( const gfx::Rect& src_subrect, const gfx::Size& dst_size, unsigned char* out, - const SkBitmap::Config bitmap_config, + const SkColorType color_type, const base::Callback<void(bool)>& callback, GLHelper::ScalerQuality quality) { - if (!IsReadbackConfigSupported(bitmap_config)) { + if (!IsReadbackConfigSupported(color_type)) { callback.Run(false); return; } @@ -489,7 +489,7 @@ void GLHelper::CopyTextureToImpl::CropScaleReadbackAndCleanTexture( #else false, #endif - bitmap_config, + color_type, quality); DCHECK(texture); ScopedFramebuffer dst_framebuffer(gl_); @@ -502,11 +502,11 @@ void GLHelper::CopyTextureToImpl::CropScaleReadbackAndCleanTexture( texture, 0); int bytes_per_pixel = 4; - switch (bitmap_config) { - case SkBitmap::kARGB_8888_Config: + switch (color_type) { + case kN32_SkColorType: // Do nothing params already set. break; - case SkBitmap::kRGB_565_Config: + case kRGB_565_SkColorType: bytes_per_pixel = 2; break; default: @@ -517,7 +517,7 @@ void GLHelper::CopyTextureToImpl::CropScaleReadbackAndCleanTexture( dst_size.width() * bytes_per_pixel, dst_size.width() * bytes_per_pixel, out, - bitmap_config, + color_type, kSwizzleNone, callback); gl_->DeleteTextures(1, &texture); @@ -527,8 +527,8 @@ void GLHelper::CopyTextureToImpl::ReadbackTextureSync( GLuint texture, const gfx::Rect& src_rect, unsigned char* out, - SkBitmap::Config bitmap_config) { - if (!IsReadbackConfigSupported(bitmap_config)) + SkColorType color_type) { + if (!IsReadbackConfigSupported(color_type)) return; ScopedFramebuffer dst_framebuffer(gl_); @@ -538,8 +538,8 @@ void GLHelper::CopyTextureToImpl::ReadbackTextureSync( gl_->FramebufferTexture2D( GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texture, 0); GLenum format = - (bitmap_config == SkBitmap::kRGB_565_Config) ? GL_RGB : GL_RGBA; - GLenum type = (bitmap_config == SkBitmap::kRGB_565_Config) + (color_type == kRGB_565_SkColorType) ? GL_RGB : GL_RGBA; + GLenum type = (color_type == kRGB_565_SkColorType) ? GL_UNSIGNED_SHORT_5_6_5 : GL_UNSIGNED_BYTE; gl_->ReadPixels(src_rect.x(), @@ -555,9 +555,9 @@ void GLHelper::CopyTextureToImpl::ReadbackTextureAsync( GLuint texture, const gfx::Size& dst_size, unsigned char* out, - SkBitmap::Config bitmap_config, + SkColorType color_type, const base::Callback<void(bool)>& callback) { - if (!IsReadbackConfigSupported(bitmap_config)) + if (!IsReadbackConfigSupported(color_type)) return; ScopedFramebuffer dst_framebuffer(gl_); @@ -569,12 +569,12 @@ void GLHelper::CopyTextureToImpl::ReadbackTextureAsync( GL_TEXTURE_2D, texture, 0); - int bytes_per_pixel = (bitmap_config == SkBitmap::kRGB_565_Config) ? 2 : 4; + int bytes_per_pixel = (color_type == kRGB_565_SkColorType) ? 2 : 4; ReadbackAsync(dst_size, dst_size.width() * bytes_per_pixel, dst_size.width() * bytes_per_pixel, out, - bitmap_config, + color_type, kSwizzleNone, callback); } @@ -591,17 +591,17 @@ GLuint GLHelper::CopyTextureToImpl::CopyAndScaleTexture( dst_size, vertically_flip_texture, false, - SkBitmap::kARGB_8888_Config, + kN32_SkColorType, quality); } bool GLHelper::CopyTextureToImpl::IsReadbackConfigSupported( - SkBitmap::Config bitmap_config) { + SkColorType color_type) { if (!helper_) { DCHECK(helper_); return false; } - return helper_->IsReadbackConfigSupported(bitmap_config); + return helper_->IsReadbackConfigSupported(color_type); } void GLHelper::CopyTextureToImpl::ReadbackDone(Request* finished_request, @@ -682,7 +682,7 @@ void GLHelper::CropScaleReadbackAndCleanTexture( const gfx::Rect& src_subrect, const gfx::Size& dst_size, unsigned char* out, - const SkBitmap::Config config, + const SkColorType color_type, const base::Callback<void(bool)>& callback, GLHelper::ScalerQuality quality) { InitCopyTextToImpl(); @@ -692,7 +692,7 @@ void GLHelper::CropScaleReadbackAndCleanTexture( src_subrect, dst_size, out, - config, + color_type, callback, quality); } @@ -704,13 +704,13 @@ void GLHelper::CropScaleReadbackAndCleanMailbox( const gfx::Rect& src_subrect, const gfx::Size& dst_size, unsigned char* out, - const SkBitmap::Config bitmap_config, + const SkColorType color_type, const base::Callback<void(bool)>& callback, GLHelper::ScalerQuality quality) { GLuint mailbox_texture = ConsumeMailboxToTexture(src_mailbox, sync_point); CropScaleReadbackAndCleanTexture( mailbox_texture, src_size, src_subrect, dst_size, out, - bitmap_config, + color_type, callback, quality); gl_->DeleteTextures(1, &mailbox_texture); @@ -719,7 +719,7 @@ void GLHelper::CropScaleReadbackAndCleanMailbox( void GLHelper::ReadbackTextureSync(GLuint texture, const gfx::Rect& src_rect, unsigned char* out, - SkBitmap::Config format) { + SkColorType format) { InitCopyTextToImpl(); copy_texture_to_impl_->ReadbackTextureSync(texture, src_rect, out, format); } @@ -728,13 +728,13 @@ void GLHelper::ReadbackTextureAsync( GLuint texture, const gfx::Size& dst_size, unsigned char* out, - SkBitmap::Config config, + SkColorType color_type, const base::Callback<void(bool)>& callback) { InitCopyTextToImpl(); copy_texture_to_impl_->ReadbackTextureAsync(texture, dst_size, out, - config, + color_type, callback); } @@ -917,7 +917,7 @@ void GLHelper::CopyTextureToImpl::ReadbackPlane( dst_subrect.width() >> size_shift, target->stride(plane), target->data(plane) + offset, - SkBitmap::kARGB_8888_Config, + kN32_SkColorType, swizzle, callback); } @@ -1194,7 +1194,7 @@ void GLHelper::CopyTextureToImpl::ReadbackYUV_MRT::ReadbackYUV( media::LetterboxYUV(target, dst_subrect_); } -bool GLHelper::IsReadbackConfigSupported(SkBitmap::Config texture_format) { +bool GLHelper::IsReadbackConfigSupported(SkColorType texture_format) { DCHECK(readback_support_.get()); return readback_support_.get()->IsReadbackConfigSupported(texture_format); } diff --git a/content/common/gpu/client/gl_helper.h b/content/common/gpu/client/gl_helper.h index 4169c8b..6c50ad1 100644 --- a/content/common/gpu/client/gl_helper.h +++ b/content/common/gpu/client/gl_helper.h @@ -172,7 +172,7 @@ class CONTENT_EXPORT GLHelper { const gfx::Rect& src_subrect, const gfx::Size& dst_size, unsigned char* out, - const SkBitmap::Config config, + const SkColorType color_type, const base::Callback<void(bool)>& callback, GLHelper::ScalerQuality quality); @@ -192,7 +192,7 @@ class CONTENT_EXPORT GLHelper { const gfx::Rect& src_subrect, const gfx::Size& dst_size, unsigned char* out, - const SkBitmap::Config config, + const SkColorType color_type, const base::Callback<void(bool)>& callback, GLHelper::ScalerQuality quality); @@ -204,12 +204,12 @@ class CONTENT_EXPORT GLHelper { void ReadbackTextureSync(GLuint texture, const gfx::Rect& src_rect, unsigned char* out, - SkBitmap::Config format); + SkColorType format); void ReadbackTextureAsync(GLuint texture, const gfx::Size& dst_size, unsigned char* out, - SkBitmap::Config config, + SkColorType color_type, const base::Callback<void(bool)>& callback); // Creates a copy of the specified texture. |size| is the size of the texture. @@ -322,7 +322,7 @@ class CONTENT_EXPORT GLHelper { // Checks whether the readbback is supported for texture with the // matching config. This doesnt check for cross format readbacks. - bool IsReadbackConfigSupported(SkBitmap::Config texture_format); + bool IsReadbackConfigSupported(SkColorType texture_format); protected: class CopyTextureToImpl; diff --git a/content/common/gpu/client/gl_helper_benchmark.cc b/content/common/gpu/client/gl_helper_benchmark.cc index 211914e..fc41fed 100644 --- a/content/common/gpu/client/gl_helper_benchmark.cc +++ b/content/common/gpu/client/gl_helper_benchmark.cc @@ -278,7 +278,7 @@ TEST_F(GLHelperTest, DISABLED_ScaleTestImage) { dst_size.width(), dst_size.height()), static_cast<unsigned char *>(output_pixels.getPixels()), - SkBitmap::kARGB_8888_Config); + kN32_SkColorType); context_->deleteTexture(dst_texture); std::string filename = base::StringPrintf("testoutput_%s_%d.ppm", kQualityNames[q], diff --git a/content/common/gpu/client/gl_helper_readback_support.cc b/content/common/gpu/client/gl_helper_readback_support.cc index 643b8ab..fc47488 100644 --- a/content/common/gpu/client/gl_helper_readback_support.cc +++ b/content/common/gpu/client/gl_helper_readback_support.cc @@ -20,27 +20,27 @@ void GLHelperReadbackSupport::InitializeReadbackSupport() { // In future if any new format support is needed that should be added here. // Initialize the array with FORMAT_NOT_SUPPORTED as we dont know the // supported formats yet. - for (int i = 0; i < SkBitmap::kConfigCount; ++i) { + for (int i = 0; i <= kLastEnum_SkColorType; ++i) { format_support_table_[i] = FORMAT_NOT_SUPPORTED; } - CheckForReadbackSupport(SkBitmap::kRGB_565_Config); - CheckForReadbackSupport(SkBitmap::kARGB_4444_Config); - CheckForReadbackSupport(SkBitmap::kARGB_8888_Config); + CheckForReadbackSupport(kRGB_565_SkColorType); + CheckForReadbackSupport(kARGB_4444_SkColorType); + CheckForReadbackSupport(kN32_SkColorType); // Further any formats, support should be checked here. } void GLHelperReadbackSupport::CheckForReadbackSupport( - SkBitmap::Config texture_format) { + SkColorType texture_format) { bool supports_format = false; switch (texture_format) { - case SkBitmap::kRGB_565_Config: + case kRGB_565_SkColorType: supports_format = SupportsFormat(GL_RGB, GL_UNSIGNED_SHORT_5_6_5); break; - case SkBitmap::kARGB_8888_Config: + case kN32_SkColorType: // This is the baseline, assume always true. supports_format = true; break; - case SkBitmap::kARGB_4444_Config: + case kARGB_4444_SkColorType: supports_format = false; break; default: @@ -48,7 +48,7 @@ void GLHelperReadbackSupport::CheckForReadbackSupport( supports_format = false; break; } - DCHECK((int)texture_format < (int)SkBitmap::kConfigCount); + DCHECK((int)texture_format <= (int)kLastEnum_SkColorType); format_support_table_[texture_format] = supports_format ? FORMAT_SUPPORTED : FORMAT_NOT_SUPPORTED; } @@ -100,7 +100,7 @@ bool GLHelperReadbackSupport::SupportsFormat(GLint format, GLint type) { } bool GLHelperReadbackSupport::IsReadbackConfigSupported( - SkBitmap::Config texture_format) { + SkColorType texture_format) { switch (format_support_table_[texture_format]) { case FORMAT_SUPPORTED: return true; diff --git a/content/common/gpu/client/gl_helper_readback_support.h b/content/common/gpu/client/gl_helper_readback_support.h index e163c76..266711c 100644 --- a/content/common/gpu/client/gl_helper_readback_support.h +++ b/content/common/gpu/client/gl_helper_readback_support.h @@ -22,7 +22,7 @@ class CONTENT_EXPORT GLHelperReadbackSupport { // For ex: some hardwares have rgb565 readback // support when binded with the frame buffer for others it may fail. // Here we pass the internal textureformat as skia config. - bool IsReadbackConfigSupported(SkBitmap::Config texture_format); + bool IsReadbackConfigSupported(SkColorType texture_format); // Provides the additional readback format/type pairing for a render target // of a given format/type pairing @@ -46,14 +46,14 @@ class CONTENT_EXPORT GLHelperReadbackSupport { // InitializeReadbackSupport. We should not use this any where // except the InitializeReadbackSupport.Calling this at other places // can distrub the state of normal gl operations. - void CheckForReadbackSupport(SkBitmap::Config texture_format); + void CheckForReadbackSupport(SkColorType texture_format); // Helper functions for checking the supported texture formats. // Avoid using this API in between texture operations, as this does some // teture opertions (bind, attach) internally. bool SupportsFormat(GLint format, GLint type); - FormatSupport format_support_table_[SkBitmap::kConfigCount]; + FormatSupport format_support_table_[kLastEnum_SkColorType + 1]; gpu::gles2::GLES2Interface* gl_; std::vector<struct FormatCacheEntry> format_cache_; diff --git a/content/common/gpu/client/gl_helper_unittest.cc b/content/common/gpu/client/gl_helper_unittest.cc index 0174a74..4ad98d1 100644 --- a/content/common/gpu/client/gl_helper_unittest.cc +++ b/content/common/gpu/client/gl_helper_unittest.cc @@ -653,7 +653,7 @@ class GLHelperTest : public testing::Test { dst_texture, gfx::Rect(0, 0, scaled_xsize, scaled_ysize), static_cast<unsigned char*>(output_pixels.getPixels()), - SkBitmap::kARGB_8888_Config); + kN32_SkColorType); if (flip) { // Flip the pixels back. FlipSKBitmap(&output_pixels); @@ -845,9 +845,9 @@ class GLHelperTest : public testing::Test { for (int x = 0; x < w; ++x) { bool on_grid = (y_on_grid || ((x % grid_pitch) < grid_width)); - if (bmp.config() == SkBitmap::kARGB_8888_Config) { + if (bmp.colorType() == kN32_SkColorType) { *bmp.getAddr32(x, y) = (on_grid ? grid_color : background_color); - } else if (bmp.config() == SkBitmap::kRGB_565_Config) { + } else if (bmp.colorType() == kRGB_565_SkColorType) { *bmp.getAddr16(x, y) = (on_grid ? grid_color : background_color); } } @@ -869,9 +869,9 @@ class GLHelperTest : public testing::Test { bool x_bit = (((x / rect_w) & 0x1) == 0); bool use_color2 = (x_bit != y_bit); // xor - if (bmp.config() == SkBitmap::kARGB_8888_Config) { + if (bmp.colorType() == kN32_SkColorType) { *bmp.getAddr32(x, y) = (use_color2 ? color2 : color1); - } else if (bmp.config() == SkBitmap::kRGB_565_Config) { + } else if (bmp.colorType() == kRGB_565_SkColorType) { *bmp.getAddr16(x, y) = (use_color2 ? color2 : color1); } } @@ -880,15 +880,15 @@ class GLHelperTest : public testing::Test { bool ColorComponentsClose(SkColor component1, SkColor component2, - SkBitmap::Config config) { + SkColorType color_type) { int c1 = static_cast<int>(component1); int c2 = static_cast<int>(component2); bool result = false; - switch (config) { - case SkBitmap::kARGB_8888_Config: + switch (color_type) { + case kN32_SkColorType: result = (std::abs(c1 - c2) == 0); break; - case SkBitmap::kRGB_565_Config: + case kRGB_565_SkColorType: result = (std::abs(c1 - c2) <= 7); break; default: @@ -897,16 +897,16 @@ class GLHelperTest : public testing::Test { return result; } - bool ColorsClose(SkColor color1, SkColor color2, SkBitmap::Config config) { + bool ColorsClose(SkColor color1, SkColor color2, SkColorType color_type) { bool red = ColorComponentsClose(SkColorGetR(color1), - SkColorGetR(color2), config); + SkColorGetR(color2), color_type); bool green = ColorComponentsClose(SkColorGetG(color1), - SkColorGetG(color2), config); + SkColorGetG(color2), color_type); bool blue = ColorComponentsClose(SkColorGetB(color1), - SkColorGetB(color2), config); + SkColorGetB(color2), color_type); bool alpha = ColorComponentsClose(SkColorGetA(color1), - SkColorGetA(color2), config); - if (config == SkBitmap::kRGB_565_Config) { + SkColorGetA(color2), color_type); + if (color_type == kRGB_565_SkColorType) { return red && blue && green; } return red && blue && green && alpha; @@ -920,7 +920,7 @@ class GLHelperTest : public testing::Test { LOG(ERROR) << "Bitmap geometry check failure"; return false; } - if (bmp1.config() != bmp2.config()) + if (bmp1.colorType() != bmp2.colorType()) return false; SkAutoLockPixels lock1(bmp1); @@ -933,7 +933,7 @@ class GLHelperTest : public testing::Test { for (int x = 0; x < bmp1.width(); ++x) { if (!ColorsClose(bmp1.getColor(x,y), bmp2.getColor(x,y), - bmp1.config())) { + bmp1.colorType())) { LOG(ERROR) << "Bitmap color comparision failure"; return false; } @@ -943,13 +943,13 @@ class GLHelperTest : public testing::Test { } void BindAndAttachTextureWithPixels(GLuint src_texture, - SkBitmap::Config bitmap_config, + SkColorType color_type, const gfx::Size& src_size, const SkBitmap& input_pixels) { context_->bindTexture(GL_TEXTURE_2D, src_texture); - GLenum format = (bitmap_config == SkBitmap::kRGB_565_Config) ? + GLenum format = (color_type == kRGB_565_SkColorType) ? GL_RGB : GL_RGBA; - GLenum type = (bitmap_config == SkBitmap::kRGB_565_Config) ? + GLenum type = (color_type == kRGB_565_SkColorType) ? GL_UNSIGNED_SHORT_5_6_5 : GL_UNSIGNED_BYTE; context_->texImage2D(GL_TEXTURE_2D, 0, @@ -965,14 +965,14 @@ class GLHelperTest : public testing::Test { void ReadBackTexture(GLuint src_texture, const gfx::Size& src_size, unsigned char* pixels, - SkBitmap::Config bitmap_config, + SkColorType color_type, bool async) { if (async) { base::RunLoop run_loop; helper_->ReadbackTextureAsync(src_texture, src_size, pixels, - bitmap_config, + color_type, base::Bind(&callcallback, run_loop.QuitClosure())); run_loop.Run(); @@ -980,21 +980,21 @@ class GLHelperTest : public testing::Test { helper_->ReadbackTextureSync(src_texture, gfx::Rect(src_size), pixels, - bitmap_config); + color_type); } } // Test basic format readback. bool TestTextureFormatReadback(const gfx::Size& src_size, - SkBitmap::Config bitmap_config, + SkColorType color_type, bool async) { SkImageInfo info = SkImageInfo::Make(src_size.width(), src_size.height(), - SkBitmapConfigToColorType(bitmap_config), + color_type, kPremul_SkAlphaType); - if (!helper_->IsReadbackConfigSupported(bitmap_config)) { - LOG(INFO) << "Skipping test format not supported" << bitmap_config; + if (!helper_->IsReadbackConfigSupported(color_type)) { + LOG(INFO) << "Skipping test format not supported" << color_type; return true; } WebGLId src_texture = context_->createTexture(); @@ -1004,7 +1004,7 @@ class GLHelperTest : public testing::Test { // Erase the input bitmap with red color. input_pixels.eraseColor(SK_ColorRED); BindAndAttachTextureWithPixels(src_texture, - bitmap_config, + color_type, src_size, input_pixels); SkBitmap output_pixels; @@ -1013,7 +1013,7 @@ class GLHelperTest : public testing::Test { // When the readback is over output bitmap should have the red color. output_pixels.eraseColor(SK_ColorGREEN); uint8* pixels = static_cast<uint8*>(output_pixels.getPixels()); - ReadBackTexture(src_texture, src_size, pixels, bitmap_config, async); + ReadBackTexture(src_texture, src_size, pixels, color_type, async); bool result = IsEqual(input_pixels, output_pixels); if (!result) { LOG(ERROR) << "Bitmap comparision failure Pattern-1"; @@ -1027,10 +1027,10 @@ class GLHelperTest : public testing::Test { src_grid_pitch, src_grid_width, input_pixels); BindAndAttachTextureWithPixels(src_texture, - bitmap_config, + color_type, src_size, input_pixels); - ReadBackTexture(src_texture, src_size, pixels, bitmap_config, async); + ReadBackTexture(src_texture, src_size, pixels, color_type, async); result = IsEqual(input_pixels, output_pixels); if (!result) { LOG(ERROR) << "Bitmap comparision failure Pattern-2"; @@ -1042,10 +1042,10 @@ class GLHelperTest : public testing::Test { color1, color2, rect_w, rect_h, input_pixels); BindAndAttachTextureWithPixels(src_texture, - bitmap_config, + color_type, src_size, input_pixels); - ReadBackTexture(src_texture, src_size, pixels, bitmap_config, async); + ReadBackTexture(src_texture, src_size, pixels, color_type, async); result = IsEqual(input_pixels, output_pixels); if (!result) { LOG(ERROR) << "Bitmap comparision failure Pattern-3"; @@ -1439,7 +1439,7 @@ class GLHelperPixelTest : public GLHelperTest { TEST_F(GLHelperTest, ARGBSyncReadbackTest) { const int kTestSize = 64; bool result = TestTextureFormatReadback(gfx::Size(kTestSize,kTestSize), - SkBitmap::kARGB_8888_Config, + kN32_SkColorType, false); EXPECT_EQ(result, true); } @@ -1447,7 +1447,7 @@ TEST_F(GLHelperTest, ARGBSyncReadbackTest) { TEST_F(GLHelperTest, RGB565SyncReadbackTest) { const int kTestSize = 64; bool result = TestTextureFormatReadback(gfx::Size(kTestSize,kTestSize), - SkBitmap::kRGB_565_Config, + kRGB_565_SkColorType, false); EXPECT_EQ(result, true); } @@ -1455,7 +1455,7 @@ TEST_F(GLHelperTest, RGB565SyncReadbackTest) { TEST_F(GLHelperTest, ARGBASyncReadbackTest) { const int kTestSize = 64; bool result = TestTextureFormatReadback(gfx::Size(kTestSize,kTestSize), - SkBitmap::kARGB_8888_Config, + kN32_SkColorType, true); EXPECT_EQ(result, true); } @@ -1463,7 +1463,7 @@ TEST_F(GLHelperTest, ARGBASyncReadbackTest) { TEST_F(GLHelperTest, RGB565ASyncReadbackTest) { const int kTestSize = 64; bool result = TestTextureFormatReadback(gfx::Size(kTestSize,kTestSize), - SkBitmap::kRGB_565_Config, + kRGB_565_SkColorType, true); EXPECT_EQ(result, true); } diff --git a/content/public/browser/render_widget_host.h b/content/public/browser/render_widget_host.h index 3030873..049ee70 100644 --- a/content/public/browser/render_widget_host.h +++ b/content/public/browser/render_widget_host.h @@ -181,7 +181,7 @@ class CONTENT_EXPORT RenderWidgetHost : public IPC::Sender { const gfx::Rect& src_rect, const gfx::Size& accelerated_dst_size, const base::Callback<void(bool, const SkBitmap&)>& callback, - const SkBitmap::Config& bitmap_config) = 0; + const SkColorType color_type) = 0; // Ensures that the view does not drop the backing store even when hidden. virtual bool CanCopyFromBackingStore() = 0; #if defined(OS_ANDROID) @@ -290,7 +290,7 @@ class CONTENT_EXPORT RenderWidgetHost : public IPC::Sender { // Get the screen info corresponding to this render widget. virtual void GetWebScreenInfo(blink::WebScreenInfo* result) = 0; - virtual SkBitmap::Config PreferredReadbackFormat() = 0; + virtual SkColorType PreferredReadbackFormat() = 0; protected: friend class RenderWidgetHostImpl; diff --git a/content/test/test_render_view_host.cc b/content/test/test_render_view_host.cc index 975c174..47792b2 100644 --- a/content/test/test_render_view_host.cc +++ b/content/test/test_render_view_host.cc @@ -107,7 +107,7 @@ void TestRenderWidgetHostView::CopyFromCompositingSurface( const gfx::Rect& src_subrect, const gfx::Size& dst_size, const base::Callback<void(bool, const SkBitmap&)>& callback, - const SkBitmap::Config config) { + const SkColorType color_type) { callback.Run(false, SkBitmap()); } diff --git a/content/test/test_render_view_host.h b/content/test/test_render_view_host.h index 8899886..5dd8a94 100644 --- a/content/test/test_render_view_host.h +++ b/content/test/test_render_view_host.h @@ -118,7 +118,7 @@ class TestRenderWidgetHostView : public RenderWidgetHostViewBase { const gfx::Rect& src_subrect, const gfx::Size& dst_size, const base::Callback<void(bool, const SkBitmap&)>& callback, - const SkBitmap::Config config) OVERRIDE; + const SkColorType color_type) OVERRIDE; virtual void CopyFromCompositingSurfaceToVideoFrame( const gfx::Rect& src_subrect, const scoped_refptr<media::VideoFrame>& target, diff --git a/skia/ext/vector_platform_device_emf_win.cc b/skia/ext/vector_platform_device_emf_win.cc index af245cd..f306316 100644 --- a/skia/ext/vector_platform_device_emf_win.cc +++ b/skia/ext/vector_platform_device_emf_win.cc @@ -895,7 +895,7 @@ void VectorPlatformDeviceEmf::InternalDrawBitmap(const SkBitmap& bitmap, bitmap_header.bV4AlphaMask = 0xff000000; SkAutoLockPixels lock(bitmap); - SkASSERT(bitmap.config() == SkBitmap::kARGB_8888_Config); + SkASSERT(bitmap.colorType() == kN32_SkColorType); const uint32_t* pixels = static_cast<const uint32_t*>(bitmap.getPixels()); if (pixels == NULL) { SkASSERT(false); diff --git a/ui/gfx/android/java_bitmap.cc b/ui/gfx/android/java_bitmap.cc index 7512b42..5988befe 100644 --- a/ui/gfx/android/java_bitmap.cc +++ b/ui/gfx/android/java_bitmap.cc @@ -41,17 +41,17 @@ bool JavaBitmap::RegisterJavaBitmap(JNIEnv* env) { return RegisterNativesImpl(env); } -static int SkBitmapConfigToBitmapFormat(SkBitmap::Config bitmap_config) { - switch (bitmap_config) { - case SkBitmap::kA8_Config: +static int SkColorTypeToBitmapFormat(SkColorType color_type) { + switch (color_type) { + case kAlpha_8_SkColorType: return BITMAP_FORMAT_ALPHA_8; - case SkBitmap::kARGB_4444_Config: + case kARGB_4444_SkColorType: return BITMAP_FORMAT_ARGB_4444; - case SkBitmap::kARGB_8888_Config: + case kN32_SkColorType: return BITMAP_FORMAT_ARGB_8888; - case SkBitmap::kRGB_565_Config: + case kRGB_565_SkColorType: return BITMAP_FORMAT_RGB_565; - case SkBitmap::kNo_Config: + case kUnknown_SkColorType: default: NOTREACHED(); return BITMAP_FORMAT_NO_CONFIG; @@ -60,10 +60,10 @@ static int SkBitmapConfigToBitmapFormat(SkBitmap::Config bitmap_config) { ScopedJavaLocalRef<jobject> CreateJavaBitmap(int width, int height, - SkBitmap::Config bitmap_config) { + SkColorType color_type) { DCHECK_GT(width, 0); DCHECK_GT(height, 0); - int java_bitmap_config = SkBitmapConfigToBitmapFormat(bitmap_config); + int java_bitmap_config = SkColorTypeToBitmapFormat(color_type); return Java_BitmapHelper_createBitmap( AttachCurrentThread(), width, height, java_bitmap_config); } @@ -82,11 +82,11 @@ ScopedJavaLocalRef<jobject> CreateJavaBitmapFromAndroidResource( ScopedJavaLocalRef<jobject> ConvertToJavaBitmap(const SkBitmap* skbitmap) { DCHECK(skbitmap); DCHECK(!skbitmap->isNull()); - SkBitmap::Config bitmap_config = skbitmap->config(); - DCHECK((bitmap_config == SkBitmap::kRGB_565_Config) || - (bitmap_config == SkBitmap::kARGB_8888_Config)); + SkColorType color_type = skbitmap->colorType(); + DCHECK((color_type == kRGB_565_SkColorType) || + (color_type == kN32_SkColorType)); ScopedJavaLocalRef<jobject> jbitmap = CreateJavaBitmap( - skbitmap->width(), skbitmap->height(), bitmap_config); + skbitmap->width(), skbitmap->height(), color_type); SkAutoLockPixels src_lock(*skbitmap); JavaBitmap dst_lock(jbitmap.obj()); void* src_pixels = skbitmap->getPixels(); @@ -120,21 +120,21 @@ SkBitmap CreateSkBitmapFromJavaBitmap(const JavaBitmap& jbitmap) { return skbitmap; } -SkBitmap::Config ConvertToSkiaConfig(jobject bitmap_config) { +SkColorType ConvertToSkiaColorType(jobject bitmap_config) { int jbitmap_config = Java_BitmapHelper_getBitmapFormatForConfig( AttachCurrentThread(), bitmap_config); switch (jbitmap_config) { case BITMAP_FORMAT_ALPHA_8: - return SkBitmap::kA8_Config; + return kAlpha_8_SkColorType; case BITMAP_FORMAT_ARGB_4444: - return SkBitmap::kARGB_4444_Config; + return kARGB_4444_SkColorType; case BITMAP_FORMAT_ARGB_8888: - return SkBitmap::kARGB_8888_Config; + return kN32_SkColorType; case BITMAP_FORMAT_RGB_565: - return SkBitmap::kRGB_565_Config; + return kRGB_565_SkColorType; case BITMAP_FORMAT_NO_CONFIG: default: - return SkBitmap::kNo_Config; + return kUnknown_SkColorType; } } diff --git a/ui/gfx/android/java_bitmap.h b/ui/gfx/android/java_bitmap.h index 44a17ca..befb09b 100644 --- a/ui/gfx/android/java_bitmap.h +++ b/ui/gfx/android/java_bitmap.h @@ -51,11 +51,11 @@ class GFX_EXPORT JavaBitmap { }; // Allocates a Java-backed bitmap (android.graphics.Bitmap) with the given -// (non-empty!) size and configuration. +// (non-empty!) size and color type. GFX_EXPORT base::android::ScopedJavaLocalRef<jobject> CreateJavaBitmap( int width, int height, - SkBitmap::Config bitmap_config); + SkColorType color_type); // Loads a Java-backed bitmap (android.graphics.Bitmap) from the provided // drawable resource identifier (e.g., android:drawable/overscroll_glow). If the @@ -74,8 +74,8 @@ GFX_EXPORT base::android::ScopedJavaLocalRef<jobject> ConvertToJavaBitmap( // Note: |jbitmap| is assumed to be non-null, non-empty and of format RGBA_8888. GFX_EXPORT SkBitmap CreateSkBitmapFromJavaBitmap(const JavaBitmap& jbitmap); -// Returns a Skia config value for the requested input java Bitmap.Config. -GFX_EXPORT SkBitmap::Config ConvertToSkiaConfig(jobject bitmap_config); +// Returns a Skia color type value for the requested input java Bitmap.Config. +GFX_EXPORT SkColorType ConvertToSkiaColorType(jobject jbitmap_config); } // namespace gfx diff --git a/ui/gfx/color_analysis_unittest.cc b/ui/gfx/color_analysis_unittest.cc index fe5b585..601089f 100644 --- a/ui/gfx/color_analysis_unittest.cc +++ b/ui/gfx/color_analysis_unittest.cc @@ -149,7 +149,7 @@ void Calculate8bitBitmapMinMax(const SkBitmap& bitmap, uint8_t* max_gl) { SkAutoLockPixels bitmap_lock(bitmap); DCHECK(bitmap.getPixels()); - DCHECK(bitmap.config() == SkBitmap::kA8_Config); + DCHECK_EQ(bitmap.colorType(), kAlpha_8_SkColorType); DCHECK(min_gl); DCHECK(max_gl); *min_gl = std::numeric_limits<uint8_t>::max(); diff --git a/ui/gfx/image/image_unittest_util.cc b/ui/gfx/image/image_unittest_util.cc index 7349c7d..0d173a6 100644 --- a/ui/gfx/image/image_unittest_util.cc +++ b/ui/gfx/image/image_unittest_util.cc @@ -103,8 +103,8 @@ bool IsEqual(const SkBitmap& bmp1, const SkBitmap& bmp2) { if (bmp1.width() != bmp2.width() || bmp1.height() != bmp2.height() || - bmp1.config() != SkBitmap::kARGB_8888_Config || - bmp2.config() != SkBitmap::kARGB_8888_Config) { + bmp1.colorType() != kN32_SkColorType || + bmp2.colorType() != kN32_SkColorType) { return false; } |