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

Unified Diff: printing/image.h

Issue 2812263002: clean up printing::Image and printing::Metafile (Closed)
Patch Set: definition matches declaration Created 3 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « printing/emf_win.h ('k') | printing/image.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: printing/image.h
diff --git a/printing/image.h b/printing/image.h
index e055d189587aaba2d05fe458b56b46c64fe25389..de9495734a41a775651945333aeedb8aee77b044 100644
--- a/printing/image.h
+++ b/printing/image.h
@@ -21,18 +21,16 @@ class FilePath;
namespace printing {
-class Metafile;
-
// Lightweight raw-bitmap management. The image, once initialized, is immutable.
// The main purpose is testing image contents.
class PRINTING_EXPORT Image {
public:
// Creates the image from the metafile. Deduces bounds based on bounds in
// metafile. If loading fails size().IsEmpty() will be true.
- explicit Image(const Metafile& metafile);
+ Image(const void* metafile_src_buffer, size_t metafile_src_buffer_size);
- // Copy constructor.
- explicit Image(const Image& image);
+ Image(const Image& image);
+ Image(Image&& image);
~Image();
@@ -46,33 +44,9 @@ class PRINTING_EXPORT Image {
// Save image as PNG.
bool SaveToPng(const base::FilePath& filepath) const;
- // Returns % of pixels different
- double PercentageDifferent(const Image& rhs) const;
-
- // Returns the 0x0RGB or 0xARGB value of the pixel at the given location.
- uint32_t Color(uint32_t color) const {
- if (ignore_alpha_)
- return color & 0xFFFFFF; // Strip out A.
- else
- return color;
- }
-
- uint32_t pixel_at(int x, int y) const {
- DCHECK(x >= 0 && x < size_.width());
- DCHECK(y >= 0 && y < size_.height());
- const uint32_t* data = reinterpret_cast<const uint32_t*>(&*data_.begin());
- const uint32_t* data_row = data + y * row_length_ / sizeof(uint32_t);
- return Color(data_row[x]);
- }
-
private:
- // Construct from metafile. This is kept internal since it's ambiguous what
- // kind of data is used (png, bmp, metafile etc).
- Image(const void* data, size_t size);
-
- bool LoadPng(const std::string& compressed);
-
- bool LoadMetafile(const Metafile& metafile);
+ bool LoadMetafile(const void* metafile_src_buffer,
+ size_t metafile_src_buffer_size);
// Pixel dimensions of the image.
gfx::Size size_;
« no previous file with comments | « printing/emf_win.h ('k') | printing/image.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698