summaryrefslogtreecommitdiffstats
path: root/skia/ext/image_operations.cc
diff options
context:
space:
mode:
authornduca@chromium.org <nduca@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-18 15:16:23 +0000
committernduca@chromium.org <nduca@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-18 15:16:23 +0000
commit7f02ff93e3f807052594f783fa2969a17681d0b8 (patch)
tree3f7ff5a918a810e3c48a36e3bf659887e7949904 /skia/ext/image_operations.cc
parent23d8008f6fd46eac505de99582ad9a9c5e7a3963 (diff)
downloadchromium_src-7f02ff93e3f807052594f783fa2969a17681d0b8.zip
chromium_src-7f02ff93e3f807052594f783fa2969a17681d0b8.tar.gz
chromium_src-7f02ff93e3f807052594f783fa2969a17681d0b8.tar.bz2
Add allocator to ImageOperations
TBR=senorblanco R=junov BUG=164052 Review URL: https://chromiumcodereview.appspot.com/12016002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@177676 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'skia/ext/image_operations.cc')
-rw-r--r--skia/ext/image_operations.cc33
1 files changed, 20 insertions, 13 deletions
diff --git a/skia/ext/image_operations.cc b/skia/ext/image_operations.cc
index b048f30..70ba7d6 100644
--- a/skia/ext/image_operations.cc
+++ b/skia/ext/image_operations.cc
@@ -18,7 +18,6 @@
#include "build/build_config.h"
#include "skia/ext/convolver.h"
#include "third_party/skia/include/core/SkColorPriv.h"
-#include "third_party/skia/include/core/SkBitmap.h"
#include "third_party/skia/include/core/SkRect.h"
#include "third_party/skia/include/core/SkFontHost.h"
@@ -344,17 +343,22 @@ ImageOperations::ResizeMethod ResizeMethodToAlgorithmMethod(
SkBitmap ImageOperations::Resize(const SkBitmap& source,
ResizeMethod method,
int dest_width, int dest_height,
- const SkIRect& dest_subset) {
- if (method == ImageOperations::RESIZE_SUBPIXEL)
- return ResizeSubpixel(source, dest_width, dest_height, dest_subset);
- else
- return ResizeBasic(source, method, dest_width, dest_height, dest_subset);
+ const SkIRect& dest_subset,
+ SkBitmap::Allocator* allocator) {
+ if (method == ImageOperations::RESIZE_SUBPIXEL) {
+ return ResizeSubpixel(source, dest_width, dest_height,
+ dest_subset, allocator);
+ } else {
+ return ResizeBasic(source, method, dest_width, dest_height, dest_subset,
+ allocator);
+ }
}
// static
SkBitmap ImageOperations::ResizeSubpixel(const SkBitmap& source,
int dest_width, int dest_height,
- const SkIRect& dest_subset) {
+ const SkIRect& dest_subset,
+ SkBitmap::Allocator* allocator) {
TRACE_EVENT2("skia", "ImageOperations::ResizeSubpixel",
"src_pixels", source.width()*source.height(),
"dst_pixels", dest_width*dest_height);
@@ -385,7 +389,7 @@ SkBitmap ImageOperations::ResizeSubpixel(const SkBitmap& source,
dest_subset.fLeft + dest_subset.width() * w,
dest_subset.fTop + dest_subset.height() * h };
SkBitmap img = ResizeBasic(source, ImageOperations::RESIZE_LANCZOS3, width,
- height, subset);
+ height, subset, allocator);
const int row_words = img.rowBytes() / 4;
if (w == 1 && h == 1)
return img;
@@ -394,7 +398,7 @@ SkBitmap ImageOperations::ResizeSubpixel(const SkBitmap& source,
SkBitmap result;
result.setConfig(SkBitmap::kARGB_8888_Config, dest_subset.width(),
dest_subset.height());
- result.allocPixels();
+ result.allocPixels(allocator, NULL);
if (!result.readyToDraw())
return img;
@@ -465,7 +469,8 @@ SkBitmap ImageOperations::ResizeSubpixel(const SkBitmap& source,
SkBitmap ImageOperations::ResizeBasic(const SkBitmap& source,
ResizeMethod method,
int dest_width, int dest_height,
- const SkIRect& dest_subset) {
+ const SkIRect& dest_subset,
+ SkBitmap::Allocator* allocator) {
TRACE_EVENT2("skia", "ImageOperations::ResizeBasic",
"src_pixels", source.width()*source.height(),
"dst_pixels", dest_width*dest_height);
@@ -511,7 +516,7 @@ SkBitmap ImageOperations::ResizeBasic(const SkBitmap& source,
SkBitmap result;
result.setConfig(SkBitmap::kARGB_8888_Config,
dest_subset.width(), dest_subset.height());
- result.allocPixels();
+ result.allocPixels(allocator, NULL);
if (!result.readyToDraw())
return SkBitmap();
@@ -533,9 +538,11 @@ SkBitmap ImageOperations::ResizeBasic(const SkBitmap& source,
// static
SkBitmap ImageOperations::Resize(const SkBitmap& source,
ResizeMethod method,
- int dest_width, int dest_height) {
+ int dest_width, int dest_height,
+ SkBitmap::Allocator* allocator) {
SkIRect dest_subset = { 0, 0, dest_width, dest_height };
- return Resize(source, method, dest_width, dest_height, dest_subset);
+ return Resize(source, method, dest_width, dest_height, dest_subset,
+ allocator);
}
} // namespace skia