Chromium Code Reviews| 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) : INHERITED(width, height) { | |
| 13 } | |
| 14 | |
| 15 SkImage_BitmapBase::SkImage_BitmapBase(const SkBitmap& bitmap) : INHERITED(bitma p.width(), bitmap.height()), fBitmap(bitmap) { | |
|
reed1
2014/09/18 13:07:16
nit : 100col limit
Rémi Piotaix
2014/09/18 18:27:15
Done.
| |
| 16 } | |
| 17 | |
| 18 SkImage_BitmapBase::~SkImage_BitmapBase() { | |
|
reed1
2014/09/18 13:07:16
nit : this is unneeded
Rémi Piotaix
2014/09/18 18:27:15
Done.
| |
| 19 } | |
| 20 | |
| 21 const SkBitmap& SkImage_BitmapBase::getBitmap() const { | |
|
reed1
2014/09/18 13:07:16
nit : this could be in the header
Rémi Piotaix
2014/09/18 18:27:15
Done.
| |
| 22 return fBitmap; | |
| 23 } | |
| 24 | |
| 25 bool SkImage_BitmapBase::isOpaque() const { | |
| 26 return this->getBitmap().isOpaque(); | |
| 27 } | |
| 28 | |
| 29 SkShader* SkImage_BitmapBase::onNewShader(SkShader::TileMode tileX, | |
| 30 SkShader::TileMode tileY, | |
| 31 const SkMatrix* localMatrix) const | |
| 32 { | |
| 33 return SkShader::CreateBitmapShader(this->getBitmap(), tileX, tileY, localMa trix); | |
| 34 } | |
| 35 | |
| 36 void SkImage_BitmapBase::onDraw(SkCanvas* canvas, SkScalar x, SkScalar y, const SkPaint* paint) const { | |
| 37 canvas->drawBitmap(this->getBitmap(), x, y, paint); | |
| 38 } | |
| 39 | |
| 40 void SkImage_BitmapBase::onDrawRectToRect(SkCanvas* canvas, const SkRect* src, c onst SkRect& dst, | |
| 41 const SkPaint* paint) const { | |
| 42 canvas->drawBitmapRectToRect(this->getBitmap(), src, dst, paint); | |
| 43 } | |
| OLD | NEW |