OLD | NEW |
(Empty) | |
| 1 /* |
| 2 * Copyright 2014 Google Inc. |
| 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. |
| 6 */ |
| 7 |
| 8 #include "SkImage_BitmapBase.h" |
| 9 |
| 10 #include "SkCanvas.h" |
| 11 |
| 12 SkImage_BitmapBase::SkImage_BitmapBase(int width, int height) |
| 13 : INHERITED(width, height) { |
| 14 } |
| 15 |
| 16 SkImage_BitmapBase::SkImage_BitmapBase(const SkBitmap& bitmap) |
| 17 : INHERITED(bitmap.width(), bitmap.height()) |
| 18 , fBitmap(bitmap) { |
| 19 } |
| 20 |
| 21 bool SkImage_BitmapBase::isOpaque() const { |
| 22 return this->getBitmap().isOpaque(); |
| 23 } |
| 24 |
| 25 SkShader* SkImage_BitmapBase::onNewShader(SkShader::TileMode tileX, |
| 26 SkShader::TileMode tileY, |
| 27 const SkMatrix* localMatrix) const |
| 28 { |
| 29 return SkShader::CreateBitmapShader(this->getBitmap(), tileX, tileY, localMa
trix); |
| 30 } |
| 31 |
| 32 void SkImage_BitmapBase::onDraw(SkCanvas* canvas, SkScalar x, SkScalar y, const
SkPaint* paint) const { |
| 33 canvas->drawBitmap(this->getBitmap(), x, y, paint); |
| 34 } |
| 35 |
| 36 void SkImage_BitmapBase::onDrawRectToRect(SkCanvas* canvas, const SkRect* src, c
onst SkRect& dst, |
| 37 const SkPaint* paint) const { |
| 38 canvas->drawBitmapRectToRect(this->getBitmap(), src, dst, paint); |
| 39 } |
OLD | NEW |