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

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

Issue 93663004: [#2] Pass gfx structs by const ref (gfx::Rect, gfx::RectF) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase to ToT, fix builds on non-linux platforms! Created 6 years, 11 months 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
« no previous file with comments | « cc/test/skia_common.h ('k') | cc/test/solid_color_content_layer_client.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 14 matching lines...) Expand all
25 25
26 SkPixelRef* TestPixelRef::deepCopy( 26 SkPixelRef* TestPixelRef::deepCopy(
27 SkBitmap::Config config, 27 SkBitmap::Config config,
28 const SkIRect* subset) { 28 const SkIRect* subset) {
29 this->ref(); 29 this->ref();
30 return this; 30 return this;
31 } 31 }
32 32
33 33
34 void DrawPicture(unsigned char* buffer, 34 void DrawPicture(unsigned char* buffer,
35 gfx::Rect layer_rect, 35 const gfx::Rect& layer_rect,
36 scoped_refptr<Picture> picture) { 36 scoped_refptr<Picture> picture) {
37 SkBitmap bitmap; 37 SkBitmap bitmap;
38 bitmap.setConfig(SkBitmap::kARGB_8888_Config, 38 bitmap.setConfig(SkBitmap::kARGB_8888_Config,
39 layer_rect.width(), 39 layer_rect.width(),
40 layer_rect.height()); 40 layer_rect.height());
41 bitmap.setPixels(buffer); 41 bitmap.setPixels(buffer);
42 SkBitmapDevice device(bitmap); 42 SkBitmapDevice device(bitmap);
43 SkCanvas canvas(&device); 43 SkCanvas canvas(&device);
44 canvas.clipRect(gfx::RectToSkRect(layer_rect)); 44 canvas.clipRect(gfx::RectToSkRect(layer_rect));
45 picture->Raster(&canvas, NULL, layer_rect, 1.0f); 45 picture->Raster(&canvas, NULL, layer_rect, 1.0f);
(...skipping 10 matching lines...) Expand all
56 skia::RefPtr<TestPixelRef> pixel_ref = 56 skia::RefPtr<TestPixelRef> pixel_ref =
57 skia::AdoptRef(new TestPixelRef(info)); 57 skia::AdoptRef(new TestPixelRef(info));
58 pixel_ref->setURI(uri); 58 pixel_ref->setURI(uri);
59 59
60 bitmap->setConfig(info); 60 bitmap->setConfig(info);
61 bitmap->setPixelRef(pixel_ref.get()); 61 bitmap->setPixelRef(pixel_ref.get());
62 } 62 }
63 63
64 64
65 } // namespace cc 65 } // namespace cc
OLDNEW
« no previous file with comments | « cc/test/skia_common.h ('k') | cc/test/solid_color_content_layer_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698