Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(168)

Side by Side Diff: cc/test/skia_common.cc

Issue 63443003: cc: Combine analysis and raster (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address feedback Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/test/skia_common.h" 5 #include "cc/test/skia_common.h"
6 6
7 #include "cc/resources/picture.h" 7 #include "cc/resources/picture.h"
8 #include "skia/ext/refptr.h" 8 #include "skia/ext/refptr.h"
9 #include "third_party/skia/include/core/SkBitmapDevice.h" 9 #include "third_party/skia/include/core/SkBitmapDevice.h"
10 #include "ui/gfx/rect.h" 10 #include "ui/gfx/rect.h"
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 gfx::Rect layer_rect, 61 gfx::Rect layer_rect,
62 scoped_refptr<Picture> picture) { 62 scoped_refptr<Picture> picture) {
63 SkBitmap bitmap; 63 SkBitmap bitmap;
64 bitmap.setConfig(SkBitmap::kARGB_8888_Config, 64 bitmap.setConfig(SkBitmap::kARGB_8888_Config,
65 layer_rect.width(), 65 layer_rect.width(),
66 layer_rect.height()); 66 layer_rect.height());
67 bitmap.setPixels(buffer); 67 bitmap.setPixels(buffer);
68 SkBitmapDevice device(bitmap); 68 SkBitmapDevice device(bitmap);
69 SkCanvas canvas(&device); 69 SkCanvas canvas(&device);
70 canvas.clipRect(gfx::RectToSkRect(layer_rect)); 70 canvas.clipRect(gfx::RectToSkRect(layer_rect));
71 picture->Raster(&canvas, NULL, layer_rect, 1.0f); 71 picture->Raster(&canvas, layer_rect, 1.0f);
72 } 72 }
73 73
74 void CreateBitmap(gfx::Size size, const char* uri, SkBitmap* bitmap) { 74 void CreateBitmap(gfx::Size size, const char* uri, SkBitmap* bitmap) {
75 skia::RefPtr<TestLazyPixelRef> lazy_pixel_ref = 75 skia::RefPtr<TestLazyPixelRef> lazy_pixel_ref =
76 skia::AdoptRef(new TestLazyPixelRef(size.width(), size.height())); 76 skia::AdoptRef(new TestLazyPixelRef(size.width(), size.height()));
77 lazy_pixel_ref->setURI(uri); 77 lazy_pixel_ref->setURI(uri);
78 78
79 bitmap->setConfig(SkBitmap::kARGB_8888_Config, 79 bitmap->setConfig(SkBitmap::kARGB_8888_Config,
80 size.width(), 80 size.width(),
81 size.height()); 81 size.height());
82 bitmap->setPixelRef(lazy_pixel_ref.get()); 82 bitmap->setPixelRef(lazy_pixel_ref.get());
83 } 83 }
84 84
85 85
86 } // namespace cc 86 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698