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

Side by Side Diff: ui/gfx/codec/png_codec.h

Issue 11028064: Resize images for hi-dpi based on a custom PNG chunk added by GRIT r78, and roll GRIT r78 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: comments Created 8 years, 2 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #ifndef UI_GFX_CODEC_PNG_CODEC_H_ 5 #ifndef UI_GFX_CODEC_PNG_CODEC_H_
6 #define UI_GFX_CODEC_PNG_CODEC_H_ 6 #define UI_GFX_CODEC_PNG_CODEC_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 int* w, int* h); 110 int* w, int* h);
111 111
112 // Decodes the PNG data directly into the passed in SkBitmap. This is 112 // Decodes the PNG data directly into the passed in SkBitmap. This is
113 // significantly faster than the vector<unsigned char> version of Decode() 113 // significantly faster than the vector<unsigned char> version of Decode()
114 // above when dealing with PNG files that are >500K, which a lot of theme 114 // above when dealing with PNG files that are >500K, which a lot of theme
115 // images are. (There are a lot of themes that have a NTP image of about ~1 115 // images are. (There are a lot of themes that have a NTP image of about ~1
116 // megabyte, and those require a 7-10 megabyte side buffer.) 116 // megabyte, and those require a 7-10 megabyte side buffer.)
117 // 117 //
118 // Returns true if data is non-null and can be decoded as a png, false 118 // Returns true if data is non-null and can be decoded as a png, false
119 // otherwise. 119 // otherwise.
120 //
121 // If the call succeeds and |fell_back_to_1x| is not NULL, it is set to true
122 // if Chrome's custom csCl PNG chunk is present (indicating that GRIT fell
123 // back to the 100% image), false if not.
124 static bool Decode(const unsigned char* input, size_t input_size,
125 SkBitmap* bitmap, bool* fell_back_to_1x);
126
127 // Equivalent to Decode(input, input_size, bitmap, NULL), for clients that
128 // don't need fell_back_to_1x returned (which is most clients).
120 static bool Decode(const unsigned char* input, size_t input_size, 129 static bool Decode(const unsigned char* input, size_t input_size,
121 SkBitmap* bitmap); 130 SkBitmap* bitmap);
122 131
123 // Create a SkBitmap from a decoded BGRA DIB. The caller owns the returned 132 // Create a SkBitmap from a decoded BGRA DIB. The caller owns the returned
124 // SkBitmap. 133 // SkBitmap.
125 static SkBitmap* CreateSkBitmapFromBGRAFormat( 134 static SkBitmap* CreateSkBitmapFromBGRAFormat(
126 std::vector<unsigned char>& bgra, int width, int height); 135 std::vector<unsigned char>& bgra, int width, int height);
127 136
128 private: 137 private:
129 DISALLOW_COPY_AND_ASSIGN(PNGCodec); 138 DISALLOW_COPY_AND_ASSIGN(PNGCodec);
130 }; 139 };
131 140
132 } // namespace gfx 141 } // namespace gfx
133 142
134 #endif // UI_GFX_CODEC_PNG_CODEC_H_ 143 #endif // UI_GFX_CODEC_PNG_CODEC_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698