зеркало из https://github.com/mozilla/moz-skia.git
fix drawfilter to match new api
enlarge default 'z' fatbits view git-svn-id: http://skia.googlecode.com/svn/trunk@1080 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
Родитель
53e3bed84b
Коммит
3ce59dc499
|
@ -105,35 +105,18 @@ class FlagsDrawFilter : public SkDrawFilter {
|
|||
public:
|
||||
FlagsDrawFilter(SkTriState lcd, SkTriState aa) : fLCDState(lcd), fAAState(aa) {}
|
||||
|
||||
virtual bool filter(SkCanvas*, SkPaint* paint, Type t) {
|
||||
virtual void filter(SkPaint* paint, Type t) {
|
||||
if (kText_Type == t && kUnknown_SkTriState != fLCDState) {
|
||||
fPrevLCD = paint->isLCDRenderText();
|
||||
paint->setLCDRenderText(kTrue_SkTriState == fLCDState);
|
||||
}
|
||||
if (kUnknown_SkTriState != fAAState) {
|
||||
fPrevAA = paint->isAntiAlias();
|
||||
paint->setAntiAlias(kTrue_SkTriState == fAAState);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/** If filter() returned true, then restore() will be called to restore the
|
||||
canvas/paint to their previous states
|
||||
*/
|
||||
virtual void restore(SkCanvas*, SkPaint* paint, Type t) {
|
||||
if (kText_Type == t && kUnknown_SkTriState != fLCDState) {
|
||||
paint->setLCDRenderText(fPrevLCD);
|
||||
}
|
||||
if (kUnknown_SkTriState != fAAState) {
|
||||
paint->setAntiAlias(fPrevAA);
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
SkTriState fLCDState;
|
||||
bool fPrevLCD;
|
||||
SkTriState fAAState;
|
||||
bool fPrevAA;
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -425,7 +408,7 @@ SampleWindow::SampleWindow(void* hwnd) : INHERITED(hwnd) {
|
|||
fScrollTestX = fScrollTestY = 0;
|
||||
|
||||
fMouseX = fMouseY = 0;
|
||||
fFatBitsScale = 1;
|
||||
fFatBitsScale = 8;
|
||||
fTypeface = SkTypeface::CreateFromTypeface(NULL, SkTypeface::kBold);
|
||||
fShowZoomer = false;
|
||||
|
||||
|
@ -604,8 +587,8 @@ void SampleWindow::draw(SkCanvas* canvas) {
|
|||
else if (fMouseY < 0) fMouseY = 0;
|
||||
SkBitmap bitmap = capture_bitmap(canvas);
|
||||
// Find the size of the zoomed in view, forced to be odd, so the examined pixel is in the middle.
|
||||
int zoomedWidth = (width >> 2) | 1;
|
||||
int zoomedHeight = (height >> 2) | 1;
|
||||
int zoomedWidth = (width >> 1) | 1;
|
||||
int zoomedHeight = (height >> 1) | 1;
|
||||
SkIRect src;
|
||||
src.set(0, 0, zoomedWidth / fFatBitsScale, zoomedHeight / fFatBitsScale);
|
||||
src.offset(fMouseX - (src.width()>>1), fMouseY - (src.height()>>1));
|
||||
|
|
Загрузка…
Ссылка в новой задаче