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

Side by Side Diff: pdf/control.cc

Issue 298803010: Print Preview: Enable PrintPreviewTest on Linux ASAN. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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 | « chrome/browser/ui/webui/print_preview/print_preview_ui_browsertest.cc ('k') | no next file » | 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 "pdf/control.h" 5 #include "pdf/control.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "pdf/draw_utils.h" 8 #include "pdf/draw_utils.h"
9 9
10 namespace chrome_pdf { 10 namespace chrome_pdf {
(...skipping 26 matching lines...) Expand all
37 37
38 void Control::PaintMultipleRects(pp::ImageData* image_data, 38 void Control::PaintMultipleRects(pp::ImageData* image_data,
39 const std::list<pp::Rect>& rects) { 39 const std::list<pp::Rect>& rects) {
40 DCHECK(rects.size() > 0); 40 DCHECK(rects.size() > 0);
41 if (rects.size() == 1) { 41 if (rects.size() == 1) {
42 Paint(image_data, rects.front()); 42 Paint(image_data, rects.front());
43 return; 43 return;
44 } 44 }
45 45
46 // Some rects in the input list may overlap. To prevent double 46 // Some rects in the input list may overlap. To prevent double
47 // paining (causes problems with semi-transparent controls) we'll 47 // painting (causes problems with semi-transparent controls) we'll
48 // paint control into buffer image data only once and copy requested 48 // paint control into buffer image data only once and copy requested
49 // rectangles. 49 // rectangles.
50 pp::ImageData buffer(owner()->GetInstance(), image_data->format(), 50 pp::ImageData buffer(owner()->GetInstance(), image_data->format(),
51 rect().size(), false); 51 rect().size(), false);
52 if (buffer.is_null())
53 return;
54
52 pp::Rect draw_rc = pp::Rect(image_data->size()).Intersect(rect()); 55 pp::Rect draw_rc = pp::Rect(image_data->size()).Intersect(rect());
53 pp::Rect ctrl_rc = pp::Rect(rect().point() - draw_rc.point(), draw_rc.size()); 56 pp::Rect ctrl_rc = pp::Rect(rect().point() - draw_rc.point(), draw_rc.size());
54 CopyImage(*image_data, draw_rc, &buffer, ctrl_rc, false); 57 CopyImage(*image_data, draw_rc, &buffer, ctrl_rc, false);
55 58
56 // Temporary move control to origin (0,0) and draw it into temp buffer. 59 // Temporary move control to origin (0,0) and draw it into temp buffer.
57 // Move to the original position afterward. Since this is going on temp 60 // Move to the original position afterward. Since this is going on temp
58 // buffer, we don't need to invalidate here. 61 // buffer, we don't need to invalidate here.
59 pp::Rect temp = rect(); 62 pp::Rect temp = rect();
60 MoveTo(pp::Point(0, 0), false); 63 MoveTo(pp::Point(0, 0), false);
61 Paint(&buffer, ctrl_rc); 64 Paint(&buffer, ctrl_rc);
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 owner()->Invalidate(id(), old_rc); 108 owner()->Invalidate(id(), old_rc);
106 owner()->Invalidate(id(), rect()); 109 owner()->Invalidate(id(), rect());
107 } 110 }
108 } 111 }
109 112
110 void Control::MoveTo(const pp::Point& origin, bool invalidate) { 113 void Control::MoveTo(const pp::Point& origin, bool invalidate) {
111 MoveBy(origin - rc_.point(), invalidate); 114 MoveBy(origin - rc_.point(), invalidate);
112 } 115 }
113 116
114 } // namespace chrome_pdf 117 } // namespace chrome_pdf
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/print_preview/print_preview_ui_browsertest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698