18e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project/*
22fc2651226baac27029e38c9d6ef883fa32084dbSteve Block * Copyright (C) 2011 Google Inc. All rights reserved.
38e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project *
48e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * Redistribution and use in source and binary forms, with or without
58e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * modification, are permitted provided that the following conditions
68e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * are met:
78e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project *
88e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * 1.  Redistributions of source code must retain the above copyright
98e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project *     notice, this list of conditions and the following disclaimer.
108e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * 2.  Redistributions in binary form must reproduce the above copyright
118e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project *     notice, this list of conditions and the following disclaimer in the
128e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project *     documentation and/or other materials provided with the distribution.
138e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project *
148e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
158e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
168e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
178e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
188e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
198e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
208e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
218e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
228e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
238e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
248e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project */
258e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project
26a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch#include "config.h"
27a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch
282fc2651226baac27029e38c9d6ef883fa32084dbSteve Block#include "LoopBlinnPathCache.h"
298e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project
30a94275402997c11dd2e778633dacf4b7e630a35dBen Murdochnamespace WebCore {
318e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project
322fc2651226baac27029e38c9d6ef883fa32084dbSteve BlockLoopBlinnPathCache::LoopBlinnPathCache()
338e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project{
348e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project}
358e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project
362fc2651226baac27029e38c9d6ef883fa32084dbSteve BlockLoopBlinnPathCache::~LoopBlinnPathCache()
378e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project{
388e35f3cfc7fba1d1c829dc557ebad6409cbe16a2The Android Open Source Project}
39a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch
402fc2651226baac27029e38c9d6ef883fa32084dbSteve Blockvoid LoopBlinnPathCache::addVertex(float x, float y,
412fc2651226baac27029e38c9d6ef883fa32084dbSteve Block                                   float k, float l, float m)
42a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch{
432fc2651226baac27029e38c9d6ef883fa32084dbSteve Block    m_vertices.append(x);
442fc2651226baac27029e38c9d6ef883fa32084dbSteve Block    m_vertices.append(y);
452fc2651226baac27029e38c9d6ef883fa32084dbSteve Block    m_texcoords.append(k);
462fc2651226baac27029e38c9d6ef883fa32084dbSteve Block    m_texcoords.append(l);
472fc2651226baac27029e38c9d6ef883fa32084dbSteve Block    m_texcoords.append(m);
48a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch}
49a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch
502fc2651226baac27029e38c9d6ef883fa32084dbSteve Blockvoid LoopBlinnPathCache::clear()
512fc2651226baac27029e38c9d6ef883fa32084dbSteve Block{
522fc2651226baac27029e38c9d6ef883fa32084dbSteve Block    m_vertices.clear();
532fc2651226baac27029e38c9d6ef883fa32084dbSteve Block    m_texcoords.clear();
542fc2651226baac27029e38c9d6ef883fa32084dbSteve Block    m_interiorVertices.clear();
552fc2651226baac27029e38c9d6ef883fa32084dbSteve Block#ifdef LOOP_BLINN_PATH_CACHE_DEBUG_INTERIOR_EDGES
562fc2651226baac27029e38c9d6ef883fa32084dbSteve Block    m_interiorEdgeVertices.clear();
572fc2651226baac27029e38c9d6ef883fa32084dbSteve Block#endif // LOOP_BLINN_PATH_CACHE_DEBUG_INTERIOR_EDGES
582fc2651226baac27029e38c9d6ef883fa32084dbSteve Block}
59a94275402997c11dd2e778633dacf4b7e630a35dBen Murdoch
602fc2651226baac27029e38c9d6ef883fa32084dbSteve Blockvoid LoopBlinnPathCache::addInteriorVertex(float x, float y)
612fc2651226baac27029e38c9d6ef883fa32084dbSteve Block{
622fc2651226baac27029e38c9d6ef883fa32084dbSteve Block    m_interiorVertices.append(x);
632fc2651226baac27029e38c9d6ef883fa32084dbSteve Block    m_interiorVertices.append(y);
642fc2651226baac27029e38c9d6ef883fa32084dbSteve Block}
652fc2651226baac27029e38c9d6ef883fa32084dbSteve Block
662fc2651226baac27029e38c9d6ef883fa32084dbSteve Block#ifdef LOOP_BLINN_PATH_CACHE_DEBUG_INTERIOR_EDGES
672fc2651226baac27029e38c9d6ef883fa32084dbSteve Blockunsigned LoopBlinnPathCache::numberOfInteriorEdgeVertices() const
682fc2651226baac27029e38c9d6ef883fa32084dbSteve Block{
692fc2651226baac27029e38c9d6ef883fa32084dbSteve Block    return m_interiorEdgeVertices.size() / 2;
702fc2651226baac27029e38c9d6ef883fa32084dbSteve Block}
712fc2651226baac27029e38c9d6ef883fa32084dbSteve Block
722fc2651226baac27029e38c9d6ef883fa32084dbSteve Blockconst float* LoopBlinnPathCache::interiorEdgeVertices() const
732fc2651226baac27029e38c9d6ef883fa32084dbSteve Block{
742fc2651226baac27029e38c9d6ef883fa32084dbSteve Block    if (!numberOfInteriorEdgeVertices())
752fc2651226baac27029e38c9d6ef883fa32084dbSteve Block        return 0;
762fc2651226baac27029e38c9d6ef883fa32084dbSteve Block    return m_interiorEdgeVertices.data();
772fc2651226baac27029e38c9d6ef883fa32084dbSteve Block}
782fc2651226baac27029e38c9d6ef883fa32084dbSteve Block
792fc2651226baac27029e38c9d6ef883fa32084dbSteve Blockvoid LoopBlinnPathCache::addInteriorEdgeVertex(float x, float y)
802fc2651226baac27029e38c9d6ef883fa32084dbSteve Block{
812fc2651226baac27029e38c9d6ef883fa32084dbSteve Block    m_interiorEdgeVertices.append(x);
822fc2651226baac27029e38c9d6ef883fa32084dbSteve Block    m_interiorEdgeVertices.append(y);
832fc2651226baac27029e38c9d6ef883fa32084dbSteve Block}
842fc2651226baac27029e38c9d6ef883fa32084dbSteve Block#endif // LOOP_BLINN_PATH_CACHE_DEBUG_INTERIOR_EDGES
852fc2651226baac27029e38c9d6ef883fa32084dbSteve Block
862fc2651226baac27029e38c9d6ef883fa32084dbSteve Block} // namespace WebCore
87