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

Side by Side Diff: debugger/QT/SkCanvasWidget.cpp

Issue 839743003: debugger: SW rasterize the picture only when it changes (Closed) Base URL: https://skia.googlesource.com/skia.git@debugcanvas-stateless-draw-01-no-resize
Patch Set: address review comment Created 5 years, 11 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
« no previous file with comments | « no previous file | debugger/QT/SkDebuggerGUI.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2012 Google Inc. 3 * Copyright 2012 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 9
10 #include "SkCanvasWidget.h" 10 #include "SkCanvasWidget.h"
11 #include <QtGui>
11 12
12 SkCanvasWidget::SkCanvasWidget(QWidget* parent, 13 SkCanvasWidget::SkCanvasWidget(QWidget* parent,
13 SkDebugger* debugger) : QWidget(parent) 14 SkDebugger* debugger) : QWidget(parent)
14 , fHorizontalLayout(this) 15 , fHorizontalLayout(this)
15 , fRasterWidget(debugger) 16 , fRasterWidget(debugger)
16 #if SK_SUPPORT_GPU 17 #if SK_SUPPORT_GPU
17 , fGLWidget(debugger) 18 , fGLWidget(debugger)
18 #endif 19 #endif
19 { 20 {
20 21
(...skipping 12 matching lines...) Expand all
33 #if SK_SUPPORT_GPU 34 #if SK_SUPPORT_GPU
34 fHorizontalLayout.addWidget(&fGLWidget); 35 fHorizontalLayout.addWidget(&fGLWidget);
35 #endif 36 #endif
36 37
37 fPreviousPoint.set(0,0); 38 fPreviousPoint.set(0,0);
38 fUserMatrix.reset(); 39 fUserMatrix.reset();
39 40
40 #if SK_SUPPORT_GPU 41 #if SK_SUPPORT_GPU
41 setWidgetVisibility(kGPU_WidgetType, true); 42 setWidgetVisibility(kGPU_WidgetType, true);
42 #endif 43 #endif
43 connect(&fRasterWidget, SIGNAL(drawComplete()), 44 connect(&fRasterWidget, SIGNAL(drawComplete()), this->parentWidget(), SLOT(d rawComplete()));
44 this->parentWidget(), SLOT(drawComplete())); 45 connect(&fGLWidget, SIGNAL(drawComplete()), this->parentWidget(), SLOT(drawC omplete()));
45 } 46 }
46 47
47 SkCanvasWidget::~SkCanvasWidget() {} 48 SkCanvasWidget::~SkCanvasWidget() {}
48 49
49 void SkCanvasWidget::drawTo(int index) { 50 void SkCanvasWidget::drawTo(int index) {
50 fDebugger->setIndex(index); 51 fDebugger->setIndex(index);
51 fRasterWidget.draw(); 52 fRasterWidget.updateImage();
52 #if SK_SUPPORT_GPU 53 #if SK_SUPPORT_GPU
53 fGLWidget.draw(); 54 fGLWidget.updateImage();
54 #endif 55 #endif
55 emit commandChanged(fDebugger->index()); 56 emit commandChanged(fDebugger->index());
56 } 57 }
57 58
58 void SkCanvasWidget::mouseMoveEvent(QMouseEvent* event) { 59 void SkCanvasWidget::mouseMoveEvent(QMouseEvent* event) {
59 SkIPoint eventPoint = SkIPoint::Make(event->globalX(), event->globalY()); 60 SkIPoint eventPoint = SkIPoint::Make(event->globalX(), event->globalY());
60 SkIPoint eventOffset = eventPoint - fPreviousPoint; 61 SkIPoint eventOffset = eventPoint - fPreviousPoint;
61 fPreviousPoint = eventPoint; 62 fPreviousPoint = eventPoint;
62 fUserMatrix.postTranslate(eventOffset.fX, eventOffset.fY); 63 fUserMatrix.postTranslate(eventOffset.fX, eventOffset.fY);
63 fDebugger->setUserMatrix(fUserMatrix); 64 fDebugger->setUserMatrix(fUserMatrix);
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 fGLWidget.setSampleCount(sampleCount); 136 fGLWidget.setSampleCount(sampleCount);
136 } 137 }
137 #endif 138 #endif
138 139
139 void SkCanvasWidget::zoom(float scale, int px, int py) { 140 void SkCanvasWidget::zoom(float scale, int px, int py) {
140 fUserMatrix.postScale(scale, scale, px, py); 141 fUserMatrix.postScale(scale, scale, px, py);
141 emit scaleFactorChanged(fUserMatrix.getScaleX()); 142 emit scaleFactorChanged(fUserMatrix.getScaleX());
142 fDebugger->setUserMatrix(fUserMatrix); 143 fDebugger->setUserMatrix(fUserMatrix);
143 drawTo(fDebugger->index()); 144 drawTo(fDebugger->index());
144 } 145 }
OLDNEW
« no previous file with comments | « no previous file | debugger/QT/SkDebuggerGUI.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698