OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 #include <new> | 7 #include <new> |
8 #include "SkBBoxHierarchy.h" | 8 #include "SkBBoxHierarchy.h" |
9 #include "SkDrawPictureCallback.h" | 9 #include "SkDrawPictureCallback.h" |
10 #include "SkPicturePlayback.h" | 10 #include "SkPicturePlayback.h" |
(...skipping 884 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
895 | 895 |
896 if (NULL != fReplacements) { | 896 if (NULL != fReplacements) { |
897 // Potentially replace a block of operations with a single drawBitma
p call | 897 // Potentially replace a block of operations with a single drawBitma
p call |
898 SkPicturePlayback::PlaybackReplacements::ReplacementInfo* temp = | 898 SkPicturePlayback::PlaybackReplacements::ReplacementInfo* temp = |
899 fReplacements->lookupByStart(reader.
offset()); | 899 fReplacements->lookupByStart(reader.
offset()); |
900 if (NULL != temp) { | 900 if (NULL != temp) { |
901 SkASSERT(NULL != temp->fBM); | 901 SkASSERT(NULL != temp->fBM); |
902 SkASSERT(NULL != temp->fPaint); | 902 SkASSERT(NULL != temp->fPaint); |
903 canvas.save(); | 903 canvas.save(); |
904 canvas.setMatrix(initialMatrix); | 904 canvas.setMatrix(initialMatrix); |
905 SkRect src = SkRect::Make(temp->fSrcRect); | 905 canvas.drawBitmap(*temp->fBM, temp->fPos.fX, temp->fPos.fY, temp
->fPaint); |
906 SkRect dst = SkRect::MakeXYWH(temp->fPos.fX, temp->fPos.fY, | |
907 temp->fSrcRect.width(), | |
908 temp->fSrcRect.height()); | |
909 canvas.drawBitmapRectToRect(*temp->fBM, &src, dst, temp->fPaint)
; | |
910 canvas.restore(); | 906 canvas.restore(); |
911 | 907 |
912 if (it.isValid()) { | 908 if (it.isValid()) { |
913 // This save is needed since the BBH will automatically issu
e | 909 // This save is needed since the BBH will automatically issu
e |
914 // a restore to balanced the saveLayer we're skipping | 910 // a restore to balanced the saveLayer we're skipping |
915 canvas.save(); | 911 canvas.save(); |
916 | 912 |
917 // At this point we know that the PictureStateTree was aimin
g | 913 // At this point we know that the PictureStateTree was aimin
g |
918 // for some draw op within temp's saveLayer (although potent
ially | 914 // for some draw op within temp's saveLayer (although potent
ially |
919 // in a separate saveLayer nested inside it). | 915 // in a separate saveLayer nested inside it). |
(...skipping 974 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1894 for (index = 0; index < fPictureCount; index++) | 1890 for (index = 0; index < fPictureCount; index++) |
1895 bufferPtr += snprintf(bufferPtr, DUMP_BUFFER_SIZE - (bufferPtr - pBuffer
), | 1891 bufferPtr += snprintf(bufferPtr, DUMP_BUFFER_SIZE - (bufferPtr - pBuffer
), |
1896 "picture%p, ", fPictureRefs[index]); | 1892 "picture%p, ", fPictureRefs[index]); |
1897 if (fPictureCount > 0) | 1893 if (fPictureCount > 0) |
1898 SkDebugf("%s0};\n", pBuffer); | 1894 SkDebugf("%s0};\n", pBuffer); |
1899 | 1895 |
1900 const_cast<SkPicturePlayback*>(this)->dumpStream(); | 1896 const_cast<SkPicturePlayback*>(this)->dumpStream(); |
1901 } | 1897 } |
1902 | 1898 |
1903 #endif | 1899 #endif |
OLD | NEW |