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

Side by Side Diff: src/image/SkImage.cpp

Issue 656503003: Move SkImage::encode to SkImageEncoder (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 2 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
« no previous file with comments | « include/core/SkImageEncoder.h ('k') | src/images/SkImageDecoder_ktx.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2012 Google Inc. 2 * Copyright 2012 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkBitmap.h" 8 #include "SkBitmap.h"
9 #include "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkImagePriv.h" 10 #include "SkImagePriv.h"
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 GrTexture* SkImage::getTexture() { 76 GrTexture* SkImage::getTexture() {
77 return as_IB(this)->onGetTexture(); 77 return as_IB(this)->onGetTexture();
78 } 78 }
79 79
80 SkShader* SkImage::newShader(SkShader::TileMode tileX, 80 SkShader* SkImage::newShader(SkShader::TileMode tileX,
81 SkShader::TileMode tileY, 81 SkShader::TileMode tileY,
82 const SkMatrix* localMatrix) const { 82 const SkMatrix* localMatrix) const {
83 return as_IB(this)->onNewShader(tileX, tileY, localMatrix); 83 return as_IB(this)->onNewShader(tileX, tileY, localMatrix);
84 } 84 }
85 85
86 SkData* SkImage::encode(SkImageEncoder::Type type, int quality) const { 86 bool SkImage::getBitmapForEncoding(SkBitmap* bm) const {
87 SkBitmap bm; 87 return as_IB(this)->getROPixels(bm);
88 if (as_IB(this)->getROPixels(&bm)) {
89 return SkImageEncoder::EncodeData(bm, type, quality);
90 }
91 return NULL;
92 } 88 }
93 89
94 /////////////////////////////////////////////////////////////////////////////// 90 ///////////////////////////////////////////////////////////////////////////////
95 91
96 static bool raster_canvas_supports(const SkImageInfo& info) { 92 static bool raster_canvas_supports(const SkImageInfo& info) {
97 switch (info.colorType()) { 93 switch (info.colorType()) {
98 case kN32_SkColorType: 94 case kN32_SkColorType:
99 return kUnpremul_SkAlphaType != info.alphaType(); 95 return kUnpremul_SkAlphaType != info.alphaType();
100 case kRGB_565_SkColorType: 96 case kRGB_565_SkColorType:
101 return true; 97 return true;
(...skipping 29 matching lines...) Expand all
131 127
132 SkCanvas canvas(*bitmap); 128 SkCanvas canvas(*bitmap);
133 129
134 SkPaint paint; 130 SkPaint paint;
135 paint.setXfermodeMode(SkXfermode::kClear_Mode); 131 paint.setXfermodeMode(SkXfermode::kClear_Mode);
136 canvas.drawRect(dstR, paint); 132 canvas.drawRect(dstR, paint);
137 133
138 canvas.drawImageRect(this, &srcR, dstR); 134 canvas.drawImageRect(this, &srcR, dstR);
139 return true; 135 return true;
140 } 136 }
OLDNEW
« no previous file with comments | « include/core/SkImageEncoder.h ('k') | src/images/SkImageDecoder_ktx.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698