| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |