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

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

Issue 271653003: Scrub deprecated Skia APIs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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
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 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 const std::vector<gfx::ImagePNGRep>& image_png_reps); 51 const std::vector<gfx::ImagePNGRep>& image_png_reps);
52 scoped_refptr<base::RefCountedMemory> Get1xPNGBytesFromImageSkia( 52 scoped_refptr<base::RefCountedMemory> Get1xPNGBytesFromImageSkia(
53 const ImageSkia* skia); 53 const ImageSkia* skia);
54 #else 54 #else
55 // Returns a 16x16 red image to visually show error in decoding PNG. 55 // Returns a 16x16 red image to visually show error in decoding PNG.
56 // Caller takes ownership of returned ImageSkia. 56 // Caller takes ownership of returned ImageSkia.
57 ImageSkia* GetErrorImageSkia() { 57 ImageSkia* GetErrorImageSkia() {
58 SkBitmap bitmap; 58 SkBitmap bitmap;
59 bitmap.setConfig(SkBitmap::kARGB_8888_Config, 16, 16); 59 bitmap.setConfig(SkBitmap::kARGB_8888_Config, 16, 16);
60 bitmap.allocPixels(); 60 bitmap.allocPixels();
61 bitmap.eraseRGB(0xff, 0, 0); 61 bitmap.eraseARGB(0xff, 0xff, 0, 0);
62 return new gfx::ImageSkia(gfx::ImageSkiaRep(bitmap, 1.0f)); 62 return new gfx::ImageSkia(gfx::ImageSkiaRep(bitmap, 1.0f));
63 } 63 }
64 64
65 ImageSkia* ImageSkiaFromPNG( 65 ImageSkia* ImageSkiaFromPNG(
66 const std::vector<gfx::ImagePNGRep>& image_png_reps) { 66 const std::vector<gfx::ImagePNGRep>& image_png_reps) {
67 if (image_png_reps.empty()) 67 if (image_png_reps.empty())
68 return GetErrorImageSkia(); 68 return GetErrorImageSkia();
69 69
70 scoped_ptr<gfx::ImageSkia> image_skia(new ImageSkia()); 70 scoped_ptr<gfx::ImageSkia> image_skia(new ImageSkia());
71 for (size_t i = 0; i < image_png_reps.size(); ++i) { 71 for (size_t i = 0; i < image_png_reps.size(); ++i) {
(...skipping 642 matching lines...) Expand 10 before | Expand all | Expand 10 after
714 } 714 }
715 return it->second; 715 return it->second;
716 } 716 }
717 717
718 void Image::AddRepresentation(internal::ImageRep* rep) const { 718 void Image::AddRepresentation(internal::ImageRep* rep) const {
719 CHECK(storage_.get()); 719 CHECK(storage_.get());
720 storage_->representations().insert(std::make_pair(rep->type(), rep)); 720 storage_->representations().insert(std::make_pair(rep->type(), rep));
721 } 721 }
722 722
723 } // namespace gfx 723 } // namespace gfx
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698