summaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authormpcomplete@chromium.org <mpcomplete@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-10 20:09:54 +0000
committermpcomplete@chromium.org <mpcomplete@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-10 20:09:54 +0000
commit1ffa6d12cd230669a9b1439ab14222094415acf8 (patch)
tree0c892499a93519b5159180c5d3982afea7da5970 /app
parent44fc30fc16c738daaef3bef331ff7a1e5b5b1b05 (diff)
downloadchromium_src-1ffa6d12cd230669a9b1439ab14222094415acf8.zip
chromium_src-1ffa6d12cd230669a9b1439ab14222094415acf8.tar.gz
chromium_src-1ffa6d12cd230669a9b1439ab14222094415acf8.tar.bz2
Revert 31478 - Add UI for turning on/off network devices.
BUG=26636 TEST=run skbitmap_operations_unittest Review URL: http://codereview.chromium.org/353028 TBR=chocobo@google.com Review URL: http://codereview.chromium.org/384014 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@31589 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'app')
-rw-r--r--app/gfx/skbitmap_operations.cc60
-rw-r--r--app/gfx/skbitmap_operations.h11
-rw-r--r--app/gfx/skbitmap_operations_unittest.cc35
3 files changed, 0 insertions, 106 deletions
diff --git a/app/gfx/skbitmap_operations.cc b/app/gfx/skbitmap_operations.cc
index 7108597..174df68 100644
--- a/app/gfx/skbitmap_operations.cc
+++ b/app/gfx/skbitmap_operations.cc
@@ -4,72 +4,12 @@
#include "app/gfx/skbitmap_operations.h"
-#include <algorithm>
-
#include "base/logging.h"
#include "third_party/skia/include/core/SkBitmap.h"
-#include "third_party/skia/include/core/SkCanvas.h"
#include "third_party/skia/include/core/SkColorPriv.h"
#include "third_party/skia/include/core/SkUnPreMultiply.h"
// static
-SkBitmap SkBitmapOperations::CreateInvertedBitmap(const SkBitmap& image) {
- DCHECK(image.config() == SkBitmap::kARGB_8888_Config);
-
- SkAutoLockPixels lock_image(image);
-
- SkBitmap inverted;
- inverted.setConfig(SkBitmap::kARGB_8888_Config, image.width(), image.height(),
- 0);
- inverted.allocPixels();
- inverted.eraseARGB(0, 0, 0, 0);
-
- for (int y = 0; y < image.height(); ++y) {
- uint32* image_row = image.getAddr32(0, y);
- uint32* dst_row = inverted.getAddr32(0, y);
-
- for (int x = 0; x < image.width(); ++x) {
- uint32 image_pixel = image_row[x];
- dst_row[x] = (image_pixel & 0xFF000000) |
- (0x00FFFFFF - (image_pixel & 0x00FFFFFF));
- }
- }
-
- return inverted;
-}
-
-// static
-SkBitmap SkBitmapOperations::CreateSuperimposedBitmap(const SkBitmap& first,
- const SkBitmap& second) {
- DCHECK(first.width() == second.width());
- DCHECK(first.height() == second.height());
- DCHECK(first.bytesPerPixel() == second.bytesPerPixel());
- DCHECK(first.config() == SkBitmap::kARGB_8888_Config);
-
- SkAutoLockPixels lock_first(first);
- SkAutoLockPixels lock_second(second);
-
- SkBitmap superimposed;
- superimposed.setConfig(SkBitmap::kARGB_8888_Config,
- first.width(), first.height());
- superimposed.allocPixels();
- superimposed.eraseARGB(0, 0, 0, 0);
-
- SkCanvas canvas(superimposed);
-
- SkRect rect;
- rect.fLeft = 0;
- rect.fTop = 0;
- rect.fRight = SkIntToScalar(first.width());
- rect.fBottom = SkIntToScalar(first.height());
-
- canvas.drawBitmapRect(first, NULL, rect);
- canvas.drawBitmapRect(second, NULL, rect);
-
- return superimposed;
-}
-
-// static
SkBitmap SkBitmapOperations::CreateBlendedBitmap(const SkBitmap& first,
const SkBitmap& second,
double alpha) {
diff --git a/app/gfx/skbitmap_operations.h b/app/gfx/skbitmap_operations.h
index 57a2301..d6bb5d3 100644
--- a/app/gfx/skbitmap_operations.h
+++ b/app/gfx/skbitmap_operations.h
@@ -12,17 +12,6 @@ class SkBitmap;
class SkBitmapOperations {
public:
- // Create a bitmap that is an inverted image of the passed in image.
- // Each color becomes its inverse in the color wheel. So (255, 15, 0) becomes
- // (0, 240, 255). The alpha value is not inverted.
- static SkBitmap CreateInvertedBitmap(const SkBitmap& image);
-
- // Create a bitmap that is a superimposition of the second bitmap on top of
- // the first. The provided bitmaps must use have the kARGB_8888_Config config
- // and be of equal dimensions.
- static SkBitmap CreateSuperimposedBitmap(const SkBitmap& first,
- const SkBitmap& second);
-
// Create a bitmap that is a blend of two others. The alpha argument
// specifies the opacity of the second bitmap. The provided bitmaps must
// use have the kARGB_8888_Config config and be of equal dimensions.
diff --git a/app/gfx/skbitmap_operations_unittest.cc b/app/gfx/skbitmap_operations_unittest.cc
index 7a68fe3..feb288c 100644
--- a/app/gfx/skbitmap_operations_unittest.cc
+++ b/app/gfx/skbitmap_operations_unittest.cc
@@ -36,41 +36,6 @@ void FillDataToBitmap(int w, int h, SkBitmap* bmp) {
} // namespace
-// Invert bitmap and verify the each pixel is inverted and the alpha value is
-// not changed.
-TEST(SkBitmapOperationsTest, CreateInvertedBitmap) {
- int src_w = 16, src_h = 16;
- SkBitmap src;
- src.setConfig(SkBitmap::kARGB_8888_Config, src_w, src_h);
- src.allocPixels();
-
- for (int y = 0; y < src_h; y++) {
- for (int x = 0; x < src_w; x++) {
- int i = y * src_w + x;
- *src.getAddr32(x, y) =
- SkColorSetARGB((255 - i) % 255, i % 255, i * 4 % 255, 0);
- }
- }
-
- SkBitmap inverted = SkBitmapOperations::CreateInvertedBitmap(src);
- SkAutoLockPixels src_lock(src);
- SkAutoLockPixels inverted_lock(inverted);
-
- for (int y = 0; y < src_h; y++) {
- for (int x = 0; x < src_w; x++) {
- int i = y * src_w + x;
- EXPECT_EQ(static_cast<unsigned int>((255 - i) % 255),
- SkColorGetA(*inverted.getAddr32(x, y)));
- EXPECT_EQ(static_cast<unsigned int>(255 - (i % 255)),
- SkColorGetR(*inverted.getAddr32(x, y)));
- EXPECT_EQ(static_cast<unsigned int>(255 - (i * 4 % 255)),
- SkColorGetG(*inverted.getAddr32(x, y)));
- EXPECT_EQ(static_cast<unsigned int>(255),
- SkColorGetB(*inverted.getAddr32(x, y)));
- }
- }
-}
-
// Blend two bitmaps together at 50% alpha and verify that the result
// is the middle-blend of the two.
TEST(SkBitmapOperationsTest, CreateBlendedBitmap) {