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

Unified Diff: src/image/SkImage_BitmapBase.cpp

Issue 577063004: Refactoring in SkImage implementations backed by a SkBitmap (Closed) Base URL: https://skia.googlesource.com/skia.git@small_refactor_skimageCodec
Patch Set: Comments Created 6 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/image/SkImage_BitmapBase.h ('k') | src/image/SkImage_Codec.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/image/SkImage_BitmapBase.cpp
diff --git a/src/image/SkImage_BitmapBase.cpp b/src/image/SkImage_BitmapBase.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..8c9e24c4965cc1fffa87c05a8143f97401fbf86c
--- /dev/null
+++ b/src/image/SkImage_BitmapBase.cpp
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2014 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include "SkImage_BitmapBase.h"
+
+#include "SkCanvas.h"
+
+SkImage_BitmapBase::SkImage_BitmapBase(int width, int height)
+ : INHERITED(width, height) {
+}
+
+SkImage_BitmapBase::SkImage_BitmapBase(const SkBitmap& bitmap)
+ : INHERITED(bitmap.width(), bitmap.height())
+ , fBitmap(bitmap) {
+}
+
+bool SkImage_BitmapBase::isOpaque() const {
+ return this->getBitmap().isOpaque();
+}
+
+SkShader* SkImage_BitmapBase::onNewShader(SkShader::TileMode tileX,
+ SkShader::TileMode tileY,
+ const SkMatrix* localMatrix) const
+{
+ return SkShader::CreateBitmapShader(this->getBitmap(), tileX, tileY, localMatrix);
+}
+
+void SkImage_BitmapBase::onDraw(SkCanvas* canvas, SkScalar x, SkScalar y, const SkPaint* paint) const {
+ canvas->drawBitmap(this->getBitmap(), x, y, paint);
+}
+
+void SkImage_BitmapBase::onDrawRectToRect(SkCanvas* canvas, const SkRect* src, const SkRect& dst,
+ const SkPaint* paint) const {
+ canvas->drawBitmapRectToRect(this->getBitmap(), src, dst, paint);
+}
« no previous file with comments | « src/image/SkImage_BitmapBase.h ('k') | src/image/SkImage_Codec.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698