OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2008 The Android Open Source Project | 2 * Copyright 2008 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 "SkBitmapDevice.h" | 8 #include "SkBitmapDevice.h" |
9 #include "SkCanvas.h" | 9 #include "SkCanvas.h" |
10 #include "SkCanvasPriv.h" | 10 #include "SkCanvasPriv.h" |
(...skipping 1914 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1925 const SkRect* cull, const SkPaint* paint) { | 1925 const SkRect* cull, const SkPaint* paint) { |
1926 if (count <= 0) { | 1926 if (count <= 0) { |
1927 return; | 1927 return; |
1928 } | 1928 } |
1929 SkASSERT(atlas); | 1929 SkASSERT(atlas); |
1930 SkASSERT(xform); | 1930 SkASSERT(xform); |
1931 SkASSERT(tex); | 1931 SkASSERT(tex); |
1932 this->onDrawAtlas(atlas, xform, tex, colors, count, mode, cull, paint); | 1932 this->onDrawAtlas(atlas, xform, tex, colors, count, mode, cull, paint); |
1933 } | 1933 } |
1934 | 1934 |
| 1935 void SkCanvas::drawLitAtlas(const SkImage* atlas, const SkRSXform xforms[], |
| 1936 const SkRect diffTex[], const SkRect normTex[], |
| 1937 const SkColor colors[], int count, SkXfermode::Mode
mode, |
| 1938 const SkRect* cull, const SkPaint* paint, |
| 1939 const SkLight lights[], int numLights) { |
| 1940 if (count <= 0) { |
| 1941 return; |
| 1942 } |
| 1943 SkASSERT(atlas); |
| 1944 SkASSERT(xforms); |
| 1945 SkASSERT(diffTex); |
| 1946 SkASSERT(normTex); |
| 1947 this->onDrawLitAtlas(atlas, xforms, diffTex, normTex, colors, count, mode, c
ull, |
| 1948 paint, lights, numLights); |
| 1949 } |
| 1950 |
1935 void SkCanvas::legacy_drawImageRect(const SkImage* image, const SkRect* src, con
st SkRect& dst, | 1951 void SkCanvas::legacy_drawImageRect(const SkImage* image, const SkRect* src, con
st SkRect& dst, |
1936 const SkPaint* paint, SrcRectConstraint cons
traint) { | 1952 const SkPaint* paint, SrcRectConstraint cons
traint) { |
1937 if (src) { | 1953 if (src) { |
1938 this->drawImageRect(image, *src, dst, paint, constraint); | 1954 this->drawImageRect(image, *src, dst, paint, constraint); |
1939 } else { | 1955 } else { |
1940 this->drawImageRect(image, SkRect::MakeIWH(image->width(), image->height
()), | 1956 this->drawImageRect(image, SkRect::MakeIWH(image->width(), image->height
()), |
1941 dst, paint, constraint); | 1957 dst, paint, constraint); |
1942 } | 1958 } |
1943 } | 1959 } |
1944 void SkCanvas::legacy_drawBitmapRect(const SkBitmap& bitmap, const SkRect* src,
const SkRect& dst, | 1960 void SkCanvas::legacy_drawBitmapRect(const SkBitmap& bitmap, const SkRect* src,
const SkRect& dst, |
(...skipping 669 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2614 pnt = *paint; | 2630 pnt = *paint; |
2615 } | 2631 } |
2616 | 2632 |
2617 LOOPER_BEGIN(pnt, SkDrawFilter::kPath_Type, NULL) | 2633 LOOPER_BEGIN(pnt, SkDrawFilter::kPath_Type, NULL) |
2618 while (iter.next()) { | 2634 while (iter.next()) { |
2619 iter.fDevice->drawAtlas(iter, atlas, xform, tex, colors, count, mode, pn
t); | 2635 iter.fDevice->drawAtlas(iter, atlas, xform, tex, colors, count, mode, pn
t); |
2620 } | 2636 } |
2621 LOOPER_END | 2637 LOOPER_END |
2622 } | 2638 } |
2623 | 2639 |
| 2640 void SkCanvas::onDrawLitAtlas(const SkImage* atlas, const SkRSXform xform[], |
| 2641 const SkRect diffTex[], const SkRect normTex[], |
| 2642 const SkColor colors[], int count, SkXfermode::Mod
e mode, |
| 2643 const SkRect* cull, const SkPaint* paint, |
| 2644 const SkLight lights[], int numLights) { |
| 2645 if (cull && this->quickReject(*cull)) { |
| 2646 return; |
| 2647 } |
| 2648 |
| 2649 SkPaint pnt; |
| 2650 if (paint) { |
| 2651 pnt = *paint; |
| 2652 } |
| 2653 |
| 2654 LOOPER_BEGIN(pnt, SkDrawFilter::kPath_Type, NULL) |
| 2655 while (iter.next()) { |
| 2656 iter.fDevice->drawLitAtlas(iter, atlas, xform, diffTex, normTex, colors,
count, mode, pnt, |
| 2657 lights, numLights); |
| 2658 } |
| 2659 LOOPER_END |
| 2660 } |
| 2661 |
2624 ////////////////////////////////////////////////////////////////////////////// | 2662 ////////////////////////////////////////////////////////////////////////////// |
2625 // These methods are NOT virtual, and therefore must call back into virtual | 2663 // These methods are NOT virtual, and therefore must call back into virtual |
2626 // methods, rather than actually drawing themselves. | 2664 // methods, rather than actually drawing themselves. |
2627 ////////////////////////////////////////////////////////////////////////////// | 2665 ////////////////////////////////////////////////////////////////////////////// |
2628 | 2666 |
2629 void SkCanvas::drawARGB(U8CPU a, U8CPU r, U8CPU g, U8CPU b, | 2667 void SkCanvas::drawARGB(U8CPU a, U8CPU r, U8CPU g, U8CPU b, |
2630 SkXfermode::Mode mode) { | 2668 SkXfermode::Mode mode) { |
2631 TRACE_EVENT0("disabled-by-default-skia", "SkCanvas::drawARGB()"); | 2669 TRACE_EVENT0("disabled-by-default-skia", "SkCanvas::drawARGB()"); |
2632 SkPaint paint; | 2670 SkPaint paint; |
2633 | 2671 |
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2884 } | 2922 } |
2885 | 2923 |
2886 if (matrix) { | 2924 if (matrix) { |
2887 canvas->concat(*matrix); | 2925 canvas->concat(*matrix); |
2888 } | 2926 } |
2889 } | 2927 } |
2890 | 2928 |
2891 SkAutoCanvasMatrixPaint::~SkAutoCanvasMatrixPaint() { | 2929 SkAutoCanvasMatrixPaint::~SkAutoCanvasMatrixPaint() { |
2892 fCanvas->restoreToCount(fSaveCount); | 2930 fCanvas->restoreToCount(fSaveCount); |
2893 } | 2931 } |
OLD | NEW |