summaryrefslogtreecommitdiffstats
path: root/ui/gfx/image/image_unittest_util.cc
diff options
context:
space:
mode:
authorpkotwicz@chromium.org <pkotwicz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-25 17:43:31 +0000
committerpkotwicz@chromium.org <pkotwicz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-25 17:43:31 +0000
commitb1a99303c1c3f4117ab6d754ed8895375471e9fa (patch)
tree55e1534ddd7c71af70b79207344d788f128ddb48 /ui/gfx/image/image_unittest_util.cc
parentbc9331f46efadce419fabb15850c1a9eaf8a0932 (diff)
downloadchromium_src-b1a99303c1c3f4117ab6d754ed8895375471e9fa.zip
chromium_src-b1a99303c1c3f4117ab6d754ed8895375471e9fa.tar.gz
chromium_src-b1a99303c1c3f4117ab6d754ed8895375471e9fa.tar.bz2
This CL adds a new object: ImageSkiaRep
The object represents an SkBitmap and the scale factor that it is painted at. The CL also changes the ImageSkia API to use ui::ScaleFactor instead of floats. In Chromium, having this object is useful because it makes extracting an SkBitmap from an ImageSkia object and packing it back into an ImageSkia object easier. In particular, this makes: float scale_factor; SkBitmap bitmap = input_image->GetBitmapForScale(1.0f, &scale_factor); // do some work with the bitmap gfx::ImageSkia output_image(bitmap, scale_factor); into gfx::ImageSkiaRep image_rep = input_image->GetRepresentation(ui::SCALE_FACTOR_100P); // do some work with the image_rep gfx::ImageSkia output_image(image_rep); R=sky TBR=sadrul for chrome/browser/chromeos/status Review URL: https://chromiumcodereview.appspot.com/10448070 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@143940 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/gfx/image/image_unittest_util.cc')
-rw-r--r--ui/gfx/image/image_unittest_util.cc14
1 files changed, 13 insertions, 1 deletions
diff --git a/ui/gfx/image/image_unittest_util.cc b/ui/gfx/image/image_unittest_util.cc
index c58c58b..7d00378 100644
--- a/ui/gfx/image/image_unittest_util.cc
+++ b/ui/gfx/image/image_unittest_util.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,6 +6,7 @@
// implementation files, this header contains the reusable components.
#include "base/memory/scoped_ptr.h"
+#include "ui/base/layout.h"
#include "ui/gfx/image/image_unittest_util.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/skia/include/core/SkBitmap.h"
@@ -20,6 +21,17 @@
namespace gfx {
namespace test {
+#if defined(OS_MACOSX)
+
+void SetSupportedScaleFactorsTo1xAnd2x() {
+ std::vector<ui::ScaleFactor> supported_scale_factors;
+ supported_scale_factors.push_back(ui::SCALE_FACTOR_100P);
+ supported_scale_factors.push_back(ui::SCALE_FACTOR_200P);
+ ui::test::SetSupportedScaleFactors(supported_scale_factors);
+}
+
+#endif // OS_MACOSX
+
const SkBitmap CreateBitmap(int width, int height) {
SkBitmap bitmap;
bitmap.setConfig(SkBitmap::kARGB_8888_Config, width, height);