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

Side by Side Diff: tests/PDFPrimitivesTest.cpp

Issue 920513003: Make filters use SkImage instead of SkBitmap Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 9 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 | « tests/ImageFilterTest.cpp ('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 /* 1 /*
2 * Copyright 2010 The Android Open Source Project 2 * Copyright 2010 The Android Open Source Project
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkBitmap.h" 8 #include "SkBitmap.h"
9 #include "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkData.h" 10 #include "SkData.h"
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 310
311 test_issue1083(); 311 test_issue1083();
312 } 312 }
313 313
314 namespace { 314 namespace {
315 315
316 class DummyImageFilter : public SkImageFilter { 316 class DummyImageFilter : public SkImageFilter {
317 public: 317 public:
318 DummyImageFilter(bool visited = false) : SkImageFilter(0, NULL), fVisited(vi sited) {} 318 DummyImageFilter(bool visited = false) : SkImageFilter(0, NULL), fVisited(vi sited) {}
319 ~DummyImageFilter() SK_OVERRIDE {} 319 ~DummyImageFilter() SK_OVERRIDE {}
320 virtual bool onFilterImage(Proxy*, const SkBitmap& src, const Context&, 320 virtual bool onFilterImage(Proxy*, const SkImage* src, const Context&,
321 SkBitmap* result, SkIPoint* offset) const SK_OVER RIDE { 321 SkAutoTUnref<const SkImage>& result,
322 SkIPoint* offset) const SK_OVERRIDE {
322 fVisited = true; 323 fVisited = true;
323 offset->fX = offset->fY = 0; 324 offset->fX = offset->fY = 0;
324 *result = src; 325 result.reset(SkRef(src));
325 return true; 326 return true;
326 } 327 }
327 SK_TO_STRING_OVERRIDE() 328 SK_TO_STRING_OVERRIDE()
328 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(DummyImageFilter) 329 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(DummyImageFilter)
329 bool visited() const { return fVisited; } 330 bool visited() const { return fVisited; }
330 331
331 private: 332 private:
332 mutable bool fVisited; 333 mutable bool fVisited;
333 }; 334 };
334 335
(...skipping 24 matching lines...) Expand all
359 // Filter just created; should be unvisited. 360 // Filter just created; should be unvisited.
360 REPORTER_ASSERT(reporter, !filter->visited()); 361 REPORTER_ASSERT(reporter, !filter->visited());
361 SkPaint paint; 362 SkPaint paint;
362 paint.setImageFilter(filter.get()); 363 paint.setImageFilter(filter.get());
363 canvas->drawRect(SkRect::MakeWH(100, 100), paint); 364 canvas->drawRect(SkRect::MakeWH(100, 100), paint);
364 doc->close(); 365 doc->close();
365 366
366 // Filter was used in rendering; should be visited. 367 // Filter was used in rendering; should be visited.
367 REPORTER_ASSERT(reporter, filter->visited()); 368 REPORTER_ASSERT(reporter, filter->visited());
368 } 369 }
OLDNEW
« no previous file with comments | « tests/ImageFilterTest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698