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

Side by Side 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: Get rid of SkImage_Codec 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 unified diff | Download patch
OLDNEW
(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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698