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