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

Unified Diff: bench/PremulAndUnpremulAlphaOpsBench.cpp

Issue 180113010: Add SkCanvas::writePixels that takes info+pixels directly (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 6 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | bench/WritePixelsBench.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: bench/PremulAndUnpremulAlphaOpsBench.cpp
diff --git a/bench/PremulAndUnpremulAlphaOpsBench.cpp b/bench/PremulAndUnpremulAlphaOpsBench.cpp
index 93c84c9095810ef33c2107fc98c81830f7a57133..4afa43fe6ebfee0c87ba1ce3f03dea70e25dd9d0 100644
--- a/bench/PremulAndUnpremulAlphaOpsBench.cpp
+++ b/bench/PremulAndUnpremulAlphaOpsBench.cpp
@@ -1,4 +1,3 @@
-
/*
* Copyright 2013 Google Inc.
*
@@ -10,6 +9,7 @@
#include "SkCanvas.h"
#include "SkConfig8888.h"
#include "SkString.h"
+#include "sk_tool_utils.h"
class PremulAndUnpremulAlphaOpsBench : public SkBenchmark {
public:
@@ -45,9 +45,16 @@ protected:
bmp2.setConfig(SkBitmap::kARGB_8888_Config, size.width(),
size.height());
+ SkColorType ct;
+ SkAlphaType at;
+ sk_tool_utils::config8888_to_imagetypes(fUnPremulConfig, &ct, &at);
+ if (bmp1.isOpaque()) {
+ at = kOpaque_SkAlphaType;
+ }
+
for (int loop = 0; loop < loops; ++loop) {
// Unpremul -> Premul
- canvas->writePixels(bmp1, 0, 0, fUnPremulConfig);
+ sk_tool_utils::write_pixels(canvas, bmp1, 0, 0, ct, at);
// Premul -> Unpremul
canvas->readPixels(&bmp2, 0, 0, fUnPremulConfig);
}
« no previous file with comments | « no previous file | bench/WritePixelsBench.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698