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

Side by Side Diff: ui/gfx/image/image.cc

Issue 361643002: setConfig is deprecated, use setInfo or allocPixels instead (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: don't call allocPixels+rowbytes yet (skia bug) Created 6 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « ui/gfx/icon_util_unittest.cc ('k') | ui/gfx/image/image_skia_operations.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/gfx/image/image.h" 5 #include "ui/gfx/image/image.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <set> 8 #include <set>
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 #if defined(OS_IOS) 51 #if defined(OS_IOS)
52 ImageSkia* ImageSkiaFromPNG( 52 ImageSkia* ImageSkiaFromPNG(
53 const std::vector<ImagePNGRep>& image_png_reps); 53 const std::vector<ImagePNGRep>& image_png_reps);
54 scoped_refptr<base::RefCountedMemory> Get1xPNGBytesFromImageSkia( 54 scoped_refptr<base::RefCountedMemory> Get1xPNGBytesFromImageSkia(
55 const ImageSkia* skia); 55 const ImageSkia* skia);
56 #else 56 #else
57 // Returns a 16x16 red image to visually show error in decoding PNG. 57 // Returns a 16x16 red image to visually show error in decoding PNG.
58 // Caller takes ownership of returned ImageSkia. 58 // Caller takes ownership of returned ImageSkia.
59 ImageSkia* GetErrorImageSkia() { 59 ImageSkia* GetErrorImageSkia() {
60 SkBitmap bitmap; 60 SkBitmap bitmap;
61 bitmap.setConfig(SkBitmap::kARGB_8888_Config, 16, 16); 61 bitmap.allocN32Pixels(16, 16);
62 bitmap.allocPixels();
63 bitmap.eraseARGB(0xff, 0xff, 0, 0); 62 bitmap.eraseARGB(0xff, 0xff, 0, 0);
64 return new ImageSkia(ImageSkiaRep(bitmap, 1.0f)); 63 return new ImageSkia(ImageSkiaRep(bitmap, 1.0f));
65 } 64 }
66 65
67 class PNGImageSource : public ImageSkiaSource { 66 class PNGImageSource : public ImageSkiaSource {
68 public: 67 public:
69 PNGImageSource() {} 68 PNGImageSource() {}
70 virtual ~PNGImageSource() {} 69 virtual ~PNGImageSource() {}
71 70
72 virtual ImageSkiaRep GetImageForScale(float scale) OVERRIDE { 71 virtual ImageSkiaRep GetImageForScale(float scale) OVERRIDE {
(...skipping 698 matching lines...) Expand 10 before | Expand all | Expand 10 after
771 } 770 }
772 return it->second; 771 return it->second;
773 } 772 }
774 773
775 void Image::AddRepresentation(internal::ImageRep* rep) const { 774 void Image::AddRepresentation(internal::ImageRep* rep) const {
776 CHECK(storage_.get()); 775 CHECK(storage_.get());
777 storage_->representations().insert(std::make_pair(rep->type(), rep)); 776 storage_->representations().insert(std::make_pair(rep->type(), rep));
778 } 777 }
779 778
780 } // namespace gfx 779 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/gfx/icon_util_unittest.cc ('k') | ui/gfx/image/image_skia_operations.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698