Commit b4e5afcd authored by fmalita's avatar fmalita Committed by Commit bot

Remove SK_SUPPORT_LEGACY_PUBLIC_IMAGEINFO_FIELDS

and convert existing clients to the public API.

R=reed@google.com
TBR=sky@chromium.org

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

Cr-Commit-Position: refs/heads/master@{#330516}
parent 6e86b73e
...@@ -134,8 +134,8 @@ TEST_F(SoftwareRendererTest, SolidColorQuad) { ...@@ -134,8 +134,8 @@ TEST_F(SoftwareRendererTest, SolidColorQuad) {
gfx::Rect device_viewport_rect(outer_size); gfx::Rect device_viewport_rect(outer_size);
scoped_ptr<SkBitmap> output = scoped_ptr<SkBitmap> output =
DrawAndCopyOutput(&list, device_scale_factor, device_viewport_rect); DrawAndCopyOutput(&list, device_scale_factor, device_viewport_rect);
EXPECT_EQ(outer_rect.width(), output->info().fWidth); EXPECT_EQ(outer_rect.width(), output->info().width());
EXPECT_EQ(outer_rect.height(), output->info().fHeight); EXPECT_EQ(outer_rect.height(), output->info().height());
EXPECT_EQ(SK_ColorYELLOW, output->getColor(0, 0)); EXPECT_EQ(SK_ColorYELLOW, output->getColor(0, 0));
EXPECT_EQ(SK_ColorYELLOW, EXPECT_EQ(SK_ColorYELLOW,
...@@ -220,8 +220,8 @@ TEST_F(SoftwareRendererTest, TileQuad) { ...@@ -220,8 +220,8 @@ TEST_F(SoftwareRendererTest, TileQuad) {
gfx::Rect device_viewport_rect(outer_size); gfx::Rect device_viewport_rect(outer_size);
scoped_ptr<SkBitmap> output = scoped_ptr<SkBitmap> output =
DrawAndCopyOutput(&list, device_scale_factor, device_viewport_rect); DrawAndCopyOutput(&list, device_scale_factor, device_viewport_rect);
EXPECT_EQ(outer_rect.width(), output->info().fWidth); EXPECT_EQ(outer_rect.width(), output->info().width());
EXPECT_EQ(outer_rect.height(), output->info().fHeight); EXPECT_EQ(outer_rect.height(), output->info().height());
EXPECT_EQ(SK_ColorYELLOW, output->getColor(0, 0)); EXPECT_EQ(SK_ColorYELLOW, output->getColor(0, 0));
EXPECT_EQ(SK_ColorYELLOW, EXPECT_EQ(SK_ColorYELLOW,
...@@ -289,8 +289,8 @@ TEST_F(SoftwareRendererTest, TileQuadVisibleRect) { ...@@ -289,8 +289,8 @@ TEST_F(SoftwareRendererTest, TileQuadVisibleRect) {
gfx::Rect device_viewport_rect(tile_size); gfx::Rect device_viewport_rect(tile_size);
scoped_ptr<SkBitmap> output = scoped_ptr<SkBitmap> output =
DrawAndCopyOutput(&list, device_scale_factor, device_viewport_rect); DrawAndCopyOutput(&list, device_scale_factor, device_viewport_rect);
EXPECT_EQ(tile_rect.width(), output->info().fWidth); EXPECT_EQ(tile_rect.width(), output->info().width());
EXPECT_EQ(tile_rect.height(), output->info().fHeight); EXPECT_EQ(tile_rect.height(), output->info().height());
// Check portion of tile not in visible rect isn't drawn. // Check portion of tile not in visible rect isn't drawn.
const unsigned int kTransparent = SK_ColorTRANSPARENT; const unsigned int kTransparent = SK_ColorTRANSPARENT;
...@@ -331,8 +331,8 @@ TEST_F(SoftwareRendererTest, ShouldClearRootRenderPass) { ...@@ -331,8 +331,8 @@ TEST_F(SoftwareRendererTest, ShouldClearRootRenderPass) {
scoped_ptr<SkBitmap> output = scoped_ptr<SkBitmap> output =
DrawAndCopyOutput(&list, device_scale_factor, device_viewport_rect); DrawAndCopyOutput(&list, device_scale_factor, device_viewport_rect);
EXPECT_EQ(device_viewport_rect.width(), output->info().fWidth); EXPECT_EQ(device_viewport_rect.width(), output->info().width());
EXPECT_EQ(device_viewport_rect.height(), output->info().fHeight); EXPECT_EQ(device_viewport_rect.height(), output->info().height());
EXPECT_EQ(SK_ColorGREEN, output->getColor(0, 0)); EXPECT_EQ(SK_ColorGREEN, output->getColor(0, 0));
EXPECT_EQ(SK_ColorGREEN, EXPECT_EQ(SK_ColorGREEN,
...@@ -353,8 +353,8 @@ TEST_F(SoftwareRendererTest, ShouldClearRootRenderPass) { ...@@ -353,8 +353,8 @@ TEST_F(SoftwareRendererTest, ShouldClearRootRenderPass) {
renderer()->DecideRenderPassAllocationsForFrame(list); renderer()->DecideRenderPassAllocationsForFrame(list);
output = DrawAndCopyOutput(&list, device_scale_factor, device_viewport_rect); output = DrawAndCopyOutput(&list, device_scale_factor, device_viewport_rect);
EXPECT_EQ(device_viewport_rect.width(), output->info().fWidth); EXPECT_EQ(device_viewport_rect.width(), output->info().width());
EXPECT_EQ(device_viewport_rect.height(), output->info().fHeight); EXPECT_EQ(device_viewport_rect.height(), output->info().height());
// If we didn't clear, the borders should still be green. // If we didn't clear, the borders should still be green.
EXPECT_EQ(SK_ColorGREEN, output->getColor(0, 0)); EXPECT_EQ(SK_ColorGREEN, output->getColor(0, 0));
...@@ -398,8 +398,8 @@ TEST_F(SoftwareRendererTest, RenderPassVisibleRect) { ...@@ -398,8 +398,8 @@ TEST_F(SoftwareRendererTest, RenderPassVisibleRect) {
scoped_ptr<SkBitmap> output = scoped_ptr<SkBitmap> output =
DrawAndCopyOutput(&list, device_scale_factor, device_viewport_rect); DrawAndCopyOutput(&list, device_scale_factor, device_viewport_rect);
EXPECT_EQ(device_viewport_rect.width(), output->info().fWidth); EXPECT_EQ(device_viewport_rect.width(), output->info().width());
EXPECT_EQ(device_viewport_rect.height(), output->info().fHeight); EXPECT_EQ(device_viewport_rect.height(), output->info().height());
EXPECT_EQ(SK_ColorGREEN, output->getColor(0, 0)); EXPECT_EQ(SK_ColorGREEN, output->getColor(0, 0));
EXPECT_EQ(SK_ColorGREEN, EXPECT_EQ(SK_ColorGREEN,
......
...@@ -193,8 +193,9 @@ void TileTaskWorkerPool::PlaybackToMemory(void* memory, ...@@ -193,8 +193,9 @@ void TileTaskWorkerPool::PlaybackToMemory(void* memory,
skia::RefPtr<SkCanvas> canvas = skia::SharePtr(surface->getCanvas()); skia::RefPtr<SkCanvas> canvas = skia::SharePtr(surface->getCanvas());
raster_source->PlaybackToCanvas(canvas.get(), rect, scale); raster_source->PlaybackToCanvas(canvas.get(), rect, scale);
SkImageInfo dst_info = info; SkImageInfo dst_info =
dst_info.fColorType = buffer_color_type; SkImageInfo::Make(info.width(), info.height(), buffer_color_type,
info.alphaType(), info.profileType());
// TODO(kaanb): The GL pipeline assumes a 4-byte alignment for the // TODO(kaanb): The GL pipeline assumes a 4-byte alignment for the
// bitmap data. There will be no need to call SkAlign4 once crbug.com/293728 // bitmap data. There will be no need to call SkAlign4 once crbug.com/293728
// is fixed. // is fixed.
......
...@@ -54,8 +54,7 @@ UIResourceBitmap::UIResourceBitmap(const SkBitmap& skbitmap) { ...@@ -54,8 +54,7 @@ UIResourceBitmap::UIResourceBitmap(const SkBitmap& skbitmap) {
skia::RefPtr<SkPixelRef> pixel_ref = skia::SharePtr(skbitmap.pixelRef()); skia::RefPtr<SkPixelRef> pixel_ref = skia::SharePtr(skbitmap.pixelRef());
const SkImageInfo& info = pixel_ref->info(); const SkImageInfo& info = pixel_ref->info();
Create(pixel_ref, Create(pixel_ref, gfx::Size(info.width(), info.height()),
gfx::Size(info.fWidth, info.fHeight),
SkColorTypeToUIResourceFormat(skbitmap.colorType())); SkColorTypeToUIResourceFormat(skbitmap.colorType()));
SetOpaque(skbitmap.isOpaque()); SetOpaque(skbitmap.isOpaque());
......
...@@ -914,8 +914,8 @@ std::pair<SkBitmap, float> ThumbnailCache::CreateApproximation( ...@@ -914,8 +914,8 @@ std::pair<SkBitmap, float> ThumbnailCache::CreateApproximation(
SkBitmap dst_bitmap; SkBitmap dst_bitmap;
dst_bitmap.allocPixels(SkImageInfo::Make(dst_size.width(), dst_bitmap.allocPixels(SkImageInfo::Make(dst_size.width(),
dst_size.height(), dst_size.height(),
bitmap.info().fColorType, bitmap.info().colorType(),
bitmap.info().fAlphaType)); bitmap.info().alphaType()));
dst_bitmap.eraseColor(0); dst_bitmap.eraseColor(0);
SkAutoLockPixels dst_bitmap_lock(dst_bitmap); SkAutoLockPixels dst_bitmap_lock(dst_bitmap);
......
...@@ -757,8 +757,8 @@ void BlinkTestRunner::CaptureDump() { ...@@ -757,8 +757,8 @@ void BlinkTestRunner::CaptureDump() {
} }
void BlinkTestRunner::CaptureDumpPixels(const SkBitmap& snapshot) { void BlinkTestRunner::CaptureDumpPixels(const SkBitmap& snapshot) {
DCHECK_NE(0, snapshot.info().fWidth); DCHECK_NE(0, snapshot.info().width());
DCHECK_NE(0, snapshot.info().fHeight); DCHECK_NE(0, snapshot.info().height());
SkAutoLockPixels snapshot_lock(snapshot); SkAutoLockPixels snapshot_lock(snapshot);
// The snapshot arrives from the GPU process via shared memory. Because MSan // The snapshot arrives from the GPU process via shared memory. Because MSan
......
...@@ -2931,10 +2931,10 @@ void TestRunner::CapturePixelsCallback(scoped_ptr<InvokeCallbackTask> task, ...@@ -2931,10 +2931,10 @@ void TestRunner::CapturePixelsCallback(scoped_ptr<InvokeCallbackTask> task,
// Size can be 0 for cases where copyImageAt was called on position // Size can be 0 for cases where copyImageAt was called on position
// that doesn't have an image. // that doesn't have an image.
int width = snapshot.info().fWidth; int width = snapshot.info().width();
argv[0] = v8::Number::New(isolate, width); argv[0] = v8::Number::New(isolate, width);
int height = snapshot.info().fHeight; int height = snapshot.info().height();
argv[1] = v8::Number::New(isolate, height); argv[1] = v8::Number::New(isolate, height);
blink::WebArrayBuffer buffer = blink::WebArrayBuffer buffer =
......
...@@ -577,9 +577,9 @@ void CaptureCallback::didCompositeAndReadback(const SkBitmap& bitmap) { ...@@ -577,9 +577,9 @@ void CaptureCallback::didCompositeAndReadback(const SkBitmap& bitmap) {
TRACE_EVENT2("shell", TRACE_EVENT2("shell",
"CaptureCallback::didCompositeAndReadback", "CaptureCallback::didCompositeAndReadback",
"x", "x",
bitmap.info().fWidth, bitmap.info().width(),
"y", "y",
bitmap.info().fHeight); bitmap.info().height());
if (!wait_for_popup_) { if (!wait_for_popup_) {
callback_.Run(bitmap); callback_.Run(bitmap);
delete this; delete this;
......
...@@ -257,10 +257,6 @@ SK_API void SkDebugf_FileLine(const char* file, int line, bool fatal, ...@@ -257,10 +257,6 @@ SK_API void SkDebugf_FileLine(const char* file, int line, bool fatal,
# define SK_SUPPORT_LEGACY_GETDEVICE # define SK_SUPPORT_LEGACY_GETDEVICE
#endif #endif
#ifndef SK_SUPPORT_LEGACY_PUBLIC_IMAGEINFO_FIELDS
# define SK_SUPPORT_LEGACY_PUBLIC_IMAGEINFO_FIELDS
#endif
#ifndef SK_IGNORE_ETC1_SUPPORT #ifndef SK_IGNORE_ETC1_SUPPORT
# define SK_IGNORE_ETC1_SUPPORT # define SK_IGNORE_ETC1_SUPPORT
#endif #endif
......
...@@ -284,7 +284,7 @@ void AcceleratedWidgetMac::GotSoftwareFrame(float scale_factor, ...@@ -284,7 +284,7 @@ void AcceleratedWidgetMac::GotSoftwareFrame(float scale_factor,
SkImageInfo info; SkImageInfo info;
size_t row_bytes; size_t row_bytes;
const void* pixels = canvas->peekPixels(&info, &row_bytes); const void* pixels = canvas->peekPixels(&info, &row_bytes);
gfx::Size pixel_size(info.fWidth, info.fHeight); gfx::Size pixel_size(info.width(), info.height());
[software_layer_ setContentsToData:pixels [software_layer_ setContentsToData:pixels
withRowBytes:row_bytes withRowBytes:row_bytes
withPixelSize:pixel_size withPixelSize:pixel_size
......
...@@ -28,10 +28,10 @@ struct SkBitmap_Data { ...@@ -28,10 +28,10 @@ struct SkBitmap_Data {
void InitSkBitmapDataForTransfer(const SkBitmap& bitmap) { void InitSkBitmapDataForTransfer(const SkBitmap& bitmap) {
const SkImageInfo& info = bitmap.info(); const SkImageInfo& info = bitmap.info();
fColorType = info.fColorType; fColorType = info.colorType();
fAlphaType = info.fAlphaType; fAlphaType = info.alphaType();
fWidth = info.fWidth; fWidth = info.width();
fHeight = info.fHeight; fHeight = info.height();
} }
// Returns whether |bitmap| successfully initialized. // Returns whether |bitmap| successfully initialized.
......
...@@ -654,10 +654,12 @@ SkBitmap SkBitmapOperations::UnPreMultiply(const SkBitmap& bitmap) { ...@@ -654,10 +654,12 @@ SkBitmap SkBitmapOperations::UnPreMultiply(const SkBitmap& bitmap) {
if (bitmap.isOpaque()) if (bitmap.isOpaque())
return bitmap; return bitmap;
SkImageInfo info = bitmap.info(); const SkImageInfo& info = bitmap.info();
info.fAlphaType = kOpaque_SkAlphaType; SkImageInfo opaque_info =
SkImageInfo::Make(info.width(), info.height(), info.colorType(),
kOpaque_SkAlphaType, info.profileType());
SkBitmap opaque_bitmap; SkBitmap opaque_bitmap;
opaque_bitmap.allocPixels(info); opaque_bitmap.allocPixels(opaque_info);
{ {
SkAutoLockPixels bitmap_lock(bitmap); SkAutoLockPixels bitmap_lock(bitmap);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment