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

Unified Diff: src/core/SkBitmapController.cpp

Issue 1346713002: move SkBitmapProvider to its own file (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix spelling Created 5 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/core/SkBitmapController.h ('k') | src/core/SkBitmapProcShader.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkBitmapController.cpp
diff --git a/src/core/SkBitmapController.cpp b/src/core/SkBitmapController.cpp
index c75d2ea6bc825c497862c7193b7d74815b105669..5cfa5252d6fcfbc2a0b33b21bfc8d12490696207 100644
--- a/src/core/SkBitmapController.cpp
+++ b/src/core/SkBitmapController.cpp
@@ -7,7 +7,7 @@
#include "SkBitmap.h"
#include "SkBitmapController.h"
-#include "SkImage_Base.h"
+#include "SkBitmapProvider.h"
#include "SkMatrix.h"
#include "SkPixelRef.h"
#include "SkTemplates.h"
@@ -17,76 +17,6 @@
///////////////////////////////////////////////////////////////////////////////////////////////////
-int SkBitmapProvider::width() const {
- return fImage ? fImage->width() : fBitmap.width();
-}
-
-int SkBitmapProvider::height() const {
- return fImage ? fImage->height() : fBitmap.height();
-}
-
-uint32_t SkBitmapProvider::getID() const {
- return fImage ? fImage->uniqueID() : fBitmap.getGenerationID();
-}
-
-bool SkBitmapProvider::validForDrawing() const {
- if (!fImage) {
- if (0 == fBitmap.width() || 0 == fBitmap.height()) {
- return false;
- }
- if (nullptr == fBitmap.pixelRef()) {
- return false; // no pixels to read
- }
- if (fBitmap.getTexture()) {
- // we can handle texture (ugh) since lockPixels will perform a read-back
- return true;
- }
- if (kIndex_8_SkColorType == fBitmap.colorType()) {
- SkAutoLockPixels alp(fBitmap); // but we need to call it before getColorTable() is safe.
- if (!fBitmap.getColorTable()) {
- return false;
- }
- }
- }
- return true;
-}
-
-SkImageInfo SkBitmapProvider::info() const {
- if (fImage) {
- SkAlphaType at = fImage->isOpaque() ? kOpaque_SkAlphaType : kPremul_SkAlphaType;
- return SkImageInfo::MakeN32(fImage->width(), fImage->height(), at);
- } else {
- return fBitmap.info();
- }
-}
-
-SkBitmapCacheDesc SkBitmapProvider::makeCacheDesc(int w, int h) const {
- return fImage ? SkBitmapCacheDesc::Make(fImage, w, h) : SkBitmapCacheDesc::Make(fBitmap, w, h);
-}
-
-SkBitmapCacheDesc SkBitmapProvider::makeCacheDesc() const {
- return fImage ? SkBitmapCacheDesc::Make(fImage) : SkBitmapCacheDesc::Make(fBitmap);
-}
-
-void SkBitmapProvider::notifyAddedToCache() const {
- if (fImage) {
- // TODO
- } else {
- fBitmap.pixelRef()->notifyAddedToCache();
- }
-}
-
-bool SkBitmapProvider::asBitmap(SkBitmap* bm) const {
- if (fImage) {
- return as_IB(fImage)->getROPixels(bm);
- } else {
- *bm = fBitmap;
- return true;
- }
-}
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
SkBitmapController::State* SkBitmapController::requestBitmap(const SkBitmapProvider& provider,
const SkMatrix& inv,
SkFilterQuality quality,
« no previous file with comments | « src/core/SkBitmapController.h ('k') | src/core/SkBitmapProcShader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698