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); |
+} |