Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 Google Inc. |
| 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 "DMSrcSink.h" | 8 #include "DMSrcSink.h" |
| 9 #include "SamplePipeControllers.h" | 9 #include "SamplePipeControllers.h" |
| 10 #include "SkCommonFlags.h" | 10 #include "SkCommonFlags.h" |
| (...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 354 | 354 |
| 355 int xPages = ((width - 1) / kLetterWidth) + 1; | 355 int xPages = ((width - 1) / kLetterWidth) + 1; |
| 356 int yPages = ((height - 1) / kLetterHeight) + 1; | 356 int yPages = ((height - 1) / kLetterHeight) + 1; |
| 357 | 357 |
| 358 for (int y = 0; y < yPages; ++y) { | 358 for (int y = 0; y < yPages; ++y) { |
| 359 for (int x = 0; x < xPages; ++x) { | 359 for (int x = 0; x < xPages; ++x) { |
| 360 int w = SkTMin(kLetterWidth, width - (x * kLetterWidth)); | 360 int w = SkTMin(kLetterWidth, width - (x * kLetterWidth)); |
| 361 int h = SkTMin(kLetterHeight, height - (y * kLetterHeight)); | 361 int h = SkTMin(kLetterHeight, height - (y * kLetterHeight)); |
| 362 SkCanvas* canvas = | 362 SkCanvas* canvas = |
| 363 doc->beginPage(SkIntToScalar(w), SkIntToScalar(h)); | 363 doc->beginPage(SkIntToScalar(w), SkIntToScalar(h)); |
| 364 if (!canvas) { | |
| 365 return "SkDocument::beginPage(w,h) returned NULL"; | |
|
djsollen
2015/04/03 13:35:01
I think it may be better if we could just produce
| |
| 366 } | |
| 364 canvas->clipRect(letter); | 367 canvas->clipRect(letter); |
| 365 canvas->translate(-letter.width() * x, -letter.height() * y); | 368 canvas->translate(-letter.width() * x, -letter.height() * y); |
| 366 Error err = src.draw(canvas); | 369 Error err = src.draw(canvas); |
| 367 if (!err.isEmpty()) { | 370 if (!err.isEmpty()) { |
| 368 return err; | 371 return err; |
| 369 } | 372 } |
| 370 doc->endPage(); | 373 doc->endPage(); |
| 371 } | 374 } |
| 372 } | 375 } |
| 373 doc->close(); | 376 doc->close(); |
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 629 surfaces.unrefAll(); | 632 surfaces.unrefAll(); |
| 630 return ""; | 633 return ""; |
| 631 } | 634 } |
| 632 SkISize size() const override { return fSize; } | 635 SkISize size() const override { return fSize; } |
| 633 Name name() const override { sk_throw(); return ""; } // No one should be calling this. | 636 Name name() const override { sk_throw(); return ""; } // No one should be calling this. |
| 634 } proxy(fW, fH, pic, src.size()); | 637 } proxy(fW, fH, pic, src.size()); |
| 635 return fSink->draw(proxy, bitmap, stream, log); | 638 return fSink->draw(proxy, bitmap, stream, log); |
| 636 } | 639 } |
| 637 | 640 |
| 638 } // namespace DM | 641 } // namespace DM |
| OLD | NEW |