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

Side by Side Diff: skia/ext/bitmap_platform_device_android.cc

Issue 11138024: Simplify platform_canvas.h by recognizing that PlatformCanvas does not actually extend (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 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
« no previous file with comments | « ppapi/thunk/ppb_image_data_api.h ('k') | skia/ext/bitmap_platform_device_linux.cc » ('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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 "skia/ext/bitmap_platform_device_android.h" 5 #include "skia/ext/bitmap_platform_device_android.h"
6 #include "skia/ext/platform_canvas.h" 6 #include "skia/ext/platform_canvas.h"
7 7
8 namespace skia { 8 namespace skia {
9 9
10 BitmapPlatformDevice* BitmapPlatformDevice::Create(int width, int height, 10 BitmapPlatformDevice* BitmapPlatformDevice::Create(int width, int height,
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 // pixels? Maybe this won't be called at all. 65 // pixels? Maybe this won't be called at all.
66 return accessBitmap(true).getPixels(); 66 return accessBitmap(true).getPixels();
67 } 67 }
68 68
69 void BitmapPlatformDevice::DrawToNativeContext( 69 void BitmapPlatformDevice::DrawToNativeContext(
70 PlatformSurface surface, int x, int y, const PlatformRect* src_rect) { 70 PlatformSurface surface, int x, int y, const PlatformRect* src_rect) {
71 // Should never be called on Android. 71 // Should never be called on Android.
72 SkASSERT(false); 72 SkASSERT(false);
73 } 73 }
74 74
75 // PlatformCanvas impl
76
77 SkCanvas* CreatePlatformCanvas(int width, int height, bool is_opaque,
78 uint8_t* data, OnFailureType failureType) {
79 SkDevice* dev = BitmapPlatformDevice::Create(width, height, is_opaque, data);
80 return CreateCanvas(dev, failureType);
81 }
82
75 // Port of PlatformBitmap to android 83 // Port of PlatformBitmap to android
76 84
77 PlatformBitmap::~PlatformBitmap() {} 85 PlatformBitmap::~PlatformBitmap() {}
78 86
79 bool PlatformBitmap::Allocate(int width, int height, bool is_opaque) { 87 bool PlatformBitmap::Allocate(int width, int height, bool is_opaque) {
80 bitmap_.setConfig(SkBitmap::kARGB_8888_Config, width, height); 88 bitmap_.setConfig(SkBitmap::kARGB_8888_Config, width, height);
81 if (!bitmap_.allocPixels()) 89 if (!bitmap_.allocPixels())
82 return false; 90 return false;
83 91
84 bitmap_.setIsOpaque(is_opaque); 92 bitmap_.setIsOpaque(is_opaque);
85 surface_ = bitmap_.getPixels(); 93 surface_ = bitmap_.getPixels();
86 return true; 94 return true;
87 } 95 }
88 96
89 } // namespace skia 97 } // namespace skia
OLDNEW
« no previous file with comments | « ppapi/thunk/ppb_image_data_api.h ('k') | skia/ext/bitmap_platform_device_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698