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

Side by Side Diff: printing/image.h

Issue 5270010: Revert 67662 - FBTF: Remove unneeded headers from base/ (part 10)... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 10 years 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 | « net/url_request/url_request.cc ('k') | printing/image.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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 PRINTING_IMAGE_H_ 5 #ifndef PRINTING_IMAGE_H_
6 #define PRINTING_IMAGE_H_ 6 #define PRINTING_IMAGE_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "base/logging.h"
12 #include "gfx/size.h" 13 #include "gfx/size.h"
13 #include "printing/native_metafile.h" 14 #include "printing/native_metafile.h"
14 15
15 class FilePath; 16 class FilePath;
16 17
17 namespace printing { 18 namespace printing {
18 19
19 // Lightweight raw-bitmap management. The image, once initialized, is immutable. 20 // Lightweight raw-bitmap management. The image, once initialized, is immutable.
20 // The main purpose is testing image contents. 21 // The main purpose is testing image contents.
21 class Image { 22 class Image {
(...skipping 26 matching lines...) Expand all
48 double PercentageDifferent(const Image& rhs) const; 49 double PercentageDifferent(const Image& rhs) const;
49 50
50 // Returns the 0x0RGB or 0xARGB value of the pixel at the given location. 51 // Returns the 0x0RGB or 0xARGB value of the pixel at the given location.
51 uint32 Color(uint32 color) const { 52 uint32 Color(uint32 color) const {
52 if (ignore_alpha_) 53 if (ignore_alpha_)
53 return color & 0xFFFFFF; // Strip out A. 54 return color & 0xFFFFFF; // Strip out A.
54 else 55 else
55 return color; 56 return color;
56 } 57 }
57 58
58 uint32 pixel_at(int x, int y) const; 59 uint32 pixel_at(int x, int y) const {
60 DCHECK(x >= 0 && x < size_.width());
61 DCHECK(y >= 0 && y < size_.height());
62 const uint32* data = reinterpret_cast<const uint32*>(&*data_.begin());
63 const uint32* data_row = data + y * row_length_ / sizeof(uint32);
64 return Color(data_row[x]);
65 }
59 66
60 private: 67 private:
61 // Construct from metafile. This is kept internal since it's ambiguous what 68 // Construct from metafile. This is kept internal since it's ambiguous what
62 // kind of data is used (png, bmp, metafile etc). 69 // kind of data is used (png, bmp, metafile etc).
63 Image(const void* data, size_t size); 70 Image(const void* data, size_t size);
64 71
65 bool LoadPng(const std::string& compressed); 72 bool LoadPng(const std::string& compressed);
66 73
67 bool LoadMetafile(const std::string& data); 74 bool LoadMetafile(const std::string& data);
68 75
(...skipping 12 matching lines...) Expand all
81 // Flag to signal if the comparison functions should ignore the alpha channel. 88 // Flag to signal if the comparison functions should ignore the alpha channel.
82 const bool ignore_alpha_; // Currently always true. 89 const bool ignore_alpha_; // Currently always true.
83 90
84 // Prevent operator= (this function has no implementation) 91 // Prevent operator= (this function has no implementation)
85 Image& operator=(const Image& image); 92 Image& operator=(const Image& image);
86 }; 93 };
87 94
88 } // namespace printing 95 } // namespace printing
89 96
90 #endif // PRINTING_IMAGE_H_ 97 #endif // PRINTING_IMAGE_H_
OLDNEW
« no previous file with comments | « net/url_request/url_request.cc ('k') | printing/image.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698