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

Unified Diff: skia/ext/bitmap_platform_device_android.cc

Issue 59133008: ozone: Support building without cairo (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase & fix whitespace 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « skia/ext/bitmap_platform_device_android.h ('k') | skia/ext/bitmap_platform_device_cairo.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: skia/ext/bitmap_platform_device_android.cc
diff --git a/skia/ext/bitmap_platform_device_android.cc b/skia/ext/bitmap_platform_device_android.cc
deleted file mode 100644
index 9d6051e22576d4452dbb97361374897851702081..0000000000000000000000000000000000000000
--- a/skia/ext/bitmap_platform_device_android.cc
+++ /dev/null
@@ -1,99 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "skia/ext/bitmap_platform_device_android.h"
-#include "skia/ext/platform_canvas.h"
-
-namespace skia {
-
-BitmapPlatformDevice* BitmapPlatformDevice::Create(int width, int height,
- bool is_opaque) {
- SkBitmap bitmap;
- bitmap.setConfig(SkBitmap::kARGB_8888_Config, width, height, 0,
- is_opaque ? kOpaque_SkAlphaType : kPremul_SkAlphaType);
- if (bitmap.allocPixels()) {
- // Follow the logic in SkCanvas::createDevice(), initialize the bitmap if it
- // is not opaque.
- if (!is_opaque)
- bitmap.eraseARGB(0, 0, 0, 0);
- return new BitmapPlatformDevice(bitmap);
- }
- return NULL;
-}
-
-BitmapPlatformDevice* BitmapPlatformDevice::CreateAndClear(int width,
- int height,
- bool is_opaque) {
- BitmapPlatformDevice* device = Create(width, height, is_opaque);
- if (!is_opaque)
- device->accessBitmap(true).eraseARGB(0, 0, 0, 0);
- return device;
-}
-
-BitmapPlatformDevice* BitmapPlatformDevice::Create(int width, int height,
- bool is_opaque,
- uint8_t* data) {
- SkBitmap bitmap;
- bitmap.setConfig(SkBitmap::kARGB_8888_Config, width, height, 0,
- is_opaque ? kOpaque_SkAlphaType : kPremul_SkAlphaType);
- if (data)
- bitmap.setPixels(data);
- else if (!bitmap.allocPixels())
- return NULL;
-
- return new BitmapPlatformDevice(bitmap);
-}
-
-BitmapPlatformDevice::BitmapPlatformDevice(const SkBitmap& bitmap)
- : SkBitmapDevice(bitmap) {
- SetPlatformDevice(this, this);
-}
-
-BitmapPlatformDevice::~BitmapPlatformDevice() {
-}
-
-SkBaseDevice* BitmapPlatformDevice::onCreateCompatibleDevice(
- SkBitmap::Config config, int width, int height, bool isOpaque,
- Usage /*usage*/) {
- SkASSERT(config == SkBitmap::kARGB_8888_Config);
- return BitmapPlatformDevice::Create(width, height, isOpaque);
-}
-
-PlatformSurface BitmapPlatformDevice::BeginPlatformPaint() {
- // TODO(zhenghao): What should we return? The ptr to the address of the
- // pixels? Maybe this won't be called at all.
- return accessBitmap(true).getPixels();
-}
-
-void BitmapPlatformDevice::DrawToNativeContext(
- PlatformSurface surface, int x, int y, const PlatformRect* src_rect) {
- // Should never be called on Android.
- SkASSERT(false);
-}
-
-// PlatformCanvas impl
-
-SkCanvas* CreatePlatformCanvas(int width, int height, bool is_opaque,
- uint8_t* data, OnFailureType failureType) {
- skia::RefPtr<SkBaseDevice> dev = skia::AdoptRef(
- BitmapPlatformDevice::Create(width, height, is_opaque, data));
- return CreateCanvas(dev, failureType);
-}
-
-// Port of PlatformBitmap to android
-PlatformBitmap::~PlatformBitmap() {
- // Nothing to do.
-}
-
-bool PlatformBitmap::Allocate(int width, int height, bool is_opaque) {
- bitmap_.setConfig(SkBitmap::kARGB_8888_Config, width, height, 0,
- is_opaque ? kOpaque_SkAlphaType : kPremul_SkAlphaType);
- if (!bitmap_.allocPixels())
- return false;
-
- surface_ = bitmap_.getPixels();
- return true;
-}
-
-} // namespace skia
« no previous file with comments | « skia/ext/bitmap_platform_device_android.h ('k') | skia/ext/bitmap_platform_device_cairo.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698