Skip to content

Commit

Permalink
SkBitmap::Config is deprecated, use SkColorType instead
Browse files Browse the repository at this point in the history
BUG=skia:2706

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@281783 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
reed@google.com committed Jul 8, 2014
1 parent 5486040 commit 3fa5258
Show file tree
Hide file tree
Showing 41 changed files with 220 additions and 222 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ bool CaptureWebContentsFunction::RunAsync() {
view->GetViewBounds().size(),
base::Bind(&CaptureWebContentsFunction::CopyFromBackingStoreComplete,
this),
SkBitmap::kARGB_8888_Config);
kN32_SkColorType);
return true;
}

Expand Down
2 changes: 1 addition & 1 deletion chrome/browser/thumbnails/thumbnail_tab_helper.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion chrome/browser/ui/pdf/pdf_browsertest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
4 changes: 2 additions & 2 deletions content/browser/android/content_readback_handler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions content/browser/android/content_view_core_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
23 changes: 11 additions & 12 deletions content/browser/compositor/delegated_frame_host.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand All @@ -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);
Expand Down Expand Up @@ -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()) {
Expand All @@ -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());
}

Expand All @@ -471,15 +471,14 @@ 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());
base::ScopedClosureRunner scoped_callback_runner(
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,
Expand Down Expand Up @@ -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),
Expand All @@ -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;
Expand Down
8 changes: 4 additions & 4 deletions content/browser/compositor/delegated_frame_host.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion content/browser/devtools/renderer_overrides_handler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}

Expand Down Expand Up @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions content/browser/frame_host/render_widget_host_view_guest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -544,8 +544,8 @@ void RenderWidgetHostViewGuest::ProcessGestures(
}
}

SkBitmap::Config RenderWidgetHostViewGuest::PreferredReadbackFormat() {
return SkBitmap::kARGB_8888_Config;
SkColorType RenderWidgetHostViewGuest::PreferredReadbackFormat() {
return kN32_SkColorType;
}

RenderWidgetHostViewBase*
Expand Down
4 changes: 2 additions & 2 deletions content/browser/frame_host/render_widget_host_view_guest.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -667,7 +667,7 @@ void WebContentsCaptureMachine::Capture(
start_time,
target,
deliver_frame_cb),
SkBitmap::kARGB_8888_Config);
kN32_SkColorType);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
8 changes: 4 additions & 4 deletions content/browser/renderer_host/render_widget_host_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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
4 changes: 2 additions & 2 deletions content/browser/renderer_host/render_widget_host_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
Loading

0 comments on commit 3fa5258

Please sign in to comment.